fix arguments in arrow functions (#2877)

This commit is contained in:
kzc
2018-02-03 01:51:19 -05:00
committed by Alex Lam S.L
parent 8e595171b9
commit 4b3c0652b7
2 changed files with 36 additions and 0 deletions

View File

@@ -383,6 +383,11 @@ AST_Lambda.DEFMETHOD("init_scope_vars", function(){
}));
});
AST_Arrow.DEFMETHOD("init_scope_vars", function(){
AST_Scope.prototype.init_scope_vars.apply(this, arguments);
this.uses_arguments = false;
});
AST_Symbol.DEFMETHOD("mark_enclosed", function(options) {
var def = this.definition();
var s = this.scope;

View File

@@ -1439,3 +1439,34 @@ issue_2794_6: {
]
node_version: ">=6"
}
inline_arrow_using_arguments: {
options = {
evaluate: true,
inline: 1,
reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
unused: true,
}
input: {
(function(){
((x) => {
console.log.apply(console, arguments),
console.log(x);
})(4);
})(3, 2, 1);
}
expect: {
(function(){
console.log.apply(console, arguments),
console.log(4);
})(3, 2, 1);
}
expect_stdout: [
"3 2 1",
"4",
]
node_version: ">=6"
}