aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJann Horn <jann@thejh.net>2016-10-14 18:04:39 +0200
committerRichard van Velzen <rvanvelzen1@gmail.com>2016-10-23 21:29:18 +0200
commit266ddd96399afcdee56d9d58b287f912b8728342 (patch)
tree2f56fa5946cf323707536a6e20154fa9ae4ac350 /test
parente51c6ba38014fc73a4804a69c556d96f777bc0b3 (diff)
downloadtracifyjs-266ddd96399afcdee56d9d58b287f912b8728342.tar.gz
tracifyjs-266ddd96399afcdee56d9d58b287f912b8728342.zip
fix uses_arguments handling (broken since 6605d1578351)
Using the symbol declaration tracking of UglifyJS doesn't make sense here anyway, `arguments` always comes from something in the current scope. fixes #1299
Diffstat (limited to 'test')
-rw-r--r--test/mocha/arguments.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/mocha/arguments.js b/test/mocha/arguments.js
index 089826fc..73993a73 100644
--- a/test/mocha/arguments.js
+++ b/test/mocha/arguments.js
@@ -19,4 +19,12 @@ describe("arguments", function() {
value // Select function as scope
);
});
+
+ it("Should recognize when a function uses arguments", function() {
+ var ast = UglifyJS.parse("function a(){function b(){function c(){}; return arguments[0];}}");
+ ast.figure_out_scope();
+ assert.strictEqual(ast.body[0].uses_arguments, false);
+ assert.strictEqual(ast.body[0].body[0].uses_arguments, true);
+ assert.strictEqual(ast.body[0].body[0].body[0].uses_arguments, false);
+ });
}); \ No newline at end of file