diff --git a/lib/process.js b/lib/process.js index 9c82bcee..0af9b4ec 100644 --- a/lib/process.js +++ b/lib/process.js @@ -128,13 +128,17 @@ function ast_walker() { return [ this[0], walk(cond), walk(t), walk(e) ]; }, "assign": function(op, lvalue, rvalue) { - return [ this[0], op, walk(lvalue), walk(rvalue) ]; + rvalue = walk(rvalue) + lvalue = walk(lvalue) + return [ this[0], op, lvalue, rvalue ]; }, "dot": function(expr) { return [ this[0], walk(expr) ].concat(slice(arguments, 1)); }, "call": function(expr, args) { - return [ this[0], walk(expr), MAP(args, walk) ]; + args = MAP(args, walk) + expr = walk(expr) + return [ this[0], expr, args ]; }, "function": function(name, args, body) { return [ this[0], name, args.slice(), MAP(body, walk) ]; @@ -249,6 +253,7 @@ function ast_walker() { }; return { + default_walkers: walkers, walk: walk, dive: dive, with_walkers: with_walkers, @@ -983,6 +988,81 @@ function ast_lift_variables(ast) { }); }; +function mergeAssignSimple(ast, options) { + var w = ast_walker() + , walk = w.walk + , mergeable = null + , obsolete = []; + + function arrayCopy(arr) { + var result = []; + for (var i=0; i