Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions test/js_optimizer/emitDCEGraph-scopes-output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"name": "emcc$defun$arrowed",
"reaches": [],
"root": true
},
{
"name": "emcc$defun$bar",
"reaches": [],
"root": true
},
{
"name": "emcc$defun$caller",
"reaches": [
"emcc$defun$foo"
],
"root": true
},
{
"name": "emcc$defun$foo",
"reaches": []
}
]
33 changes: 33 additions & 0 deletions test/js_optimizer/emitDCEGraph-scopes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function foo() {}

function bar() {}

// caller() calls foo(). There is also another function called "caller", down
// below, which should not confuse us (if it does, nothing would refer to foo,
// and instead we'd think the toplevel caller calls bar).
function caller() {
foo();
}

caller();

var object = {
method() {
function caller(data) {
bar();
}
}
};

// Similar, with an arrow function. This should also not confuse us (it would
// make "caller" refer to "arrowed".

function arrowed() {}

var arrow = () => {
function caller(data) {
arrowed();
}
}

wasmImports = {};
1 change: 1 addition & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2896,6 +2896,7 @@ def test_extern_prepost(self):
'emitDCEGraph3': (['emitDCEGraph', '--no-print'],),
'emitDCEGraph4': (['emitDCEGraph', '--no-print'],),
'emitDCEGraph5': (['emitDCEGraph', '--no-print'],),
'emitDCEGraph-scopes': (['emitDCEGraph', '--no-print'],),
'minimal-runtime-applyDCEGraphRemovals': (['applyDCEGraphRemovals'],),
'applyDCEGraphRemovals': (['applyDCEGraphRemovals'],),
'applyImportAndExportNameChanges': (['applyImportAndExportNameChanges'],),
Expand Down
Loading
Loading