fix order of visit for TreeWalker

This commit is contained in:
alexlamsl 2017-04-16 17:48:32 +08:00
parent b66ee8ab50
commit 34be48a6f9
2 changed files with 30 additions and 1 deletions

View File

@ -543,11 +543,11 @@ var AST_Call = DEFNODE("Call", "expression args", {
},
_walk: function(visitor) {
return visitor._visit(this, function(){
this.expression._walk(visitor);
var args = this.args;
for (var i = 0, len = args.length; i < len; i++) {
args[i]._walk(visitor);
}
this.expression._walk(visitor);
});
}
});

View File

@ -2087,6 +2087,35 @@ var_assign_4: {
}
}
var_assign_5: {
options = {
evaluate: true,
reduce_vars: true,
sequences: true,
side_effects: true,
unused: true,
}
input: {
!function() {
var a;
!function(b) {
a = 2;
console.log(a, b);
}(a);
}();
}
expect: {
!function() {
var a;
!function(b) {
a = 2,
console.log(a, b);
}(a);
}();
}
expect_stdout: "2 undefined"
}
immutable: {
options = {
evaluate: true,