node.value.walk(tw);
pop(tw);
var save = fixed;
- fixed = function() {
+ if (save) fixed = function() {
var value = save();
return is_undefined(value) ? make_sequence(node, [ value, node.value ]) : node.name;
};
var save = fixed;
node.elements.forEach(function(node, index) {
if (node instanceof AST_Hole) return reset_flags(node);
- fixed = function() {
+ if (save) fixed = function() {
return make_node(AST_Sub, node, {
expression: save(),
property: make_node(AST_Number, node, {
node.walk(scanner);
});
if (node.rest) {
- fixed = compressor.option("rests") && function() {
+ if (save) fixed = compressor.option("rests") && function() {
var value = save();
return value instanceof AST_Array ? make_node(AST_Array, node, {
elements: value.elements.slice(node.elements.length),
node.key.walk(tw);
pop(tw);
}
- fixed = function() {
+ if (save) fixed = function() {
var key = node.key;
var type = AST_Sub;
if (typeof key == "string") {
scan_declaration(tw, compressor, arg, function() {
var j = fn.argnames.indexOf(arg);
return (j < 0 ? value : iife.args[j]) || make_node(AST_Undefined, iife);
- }, function(node, fixed) {
- var d = node.definition();
- if (fixed && safe && d.fixed === undefined) {
- mark(tw, d);
- tw.loop_ids[d.id] = tw.in_loop;
- var value = iife.args[i];
- d.fixed = fixed;
- d.fixed.assigns = [ arg ];
- } else {
- d.fixed = false;
- }
- });
+ }, visit);
});
+ if (fn.rest) scan_declaration(tw, compressor, fn.rest, compressor.option("rests") && function() {
+ return make_node(AST_Array, fn, {
+ elements: iife.args.slice(fn.argnames.length),
+ });
+ }, visit);
walk_lambda(fn, tw);
var safe_ids = tw.safe_ids;
pop(tw);
walk_defuns(tw, fn);
if (!aborts) tw.safe_ids = safe_ids;
return true;
+
+ function visit(node, fixed) {
+ var d = node.definition();
+ if (fixed && safe && d.fixed === undefined) {
+ mark(tw, d);
+ tw.loop_ids[d.id] = tw.in_loop;
+ d.fixed = fixed;
+ d.fixed.assigns = [ node ];
+ } else {
+ d.fixed = false;
+ }
+ }
}
def(AST_Assign, function(tw, descend, compressor) {