if (old_def) old_def.forEach(function(node) {
node.name = name_def.name;
node.thedef = name_def;
- node.reference({});
+ node.reference();
});
body.push(defun);
} else {
scope: self,
thedef: decl.definition()
});
- sym.reference({});
+ sym.reference();
assignments.push(make_node(AST_Assign, node, {
operator: "=",
left: sym,
scope: node.expression.scope,
thedef: def
});
- sym.reference({});
+ sym.reference();
return sym;
}
if (node instanceof AST_Unary) {
node = maintain_this_binding(compressor, parent, current, node);
if (replacing || best_of_expression(node, self) === node) {
refs.forEach(function(ref) {
- var def = ref.definition();
- def.references.push(ref);
+ ref.scope = exp === fn ? fn.parent_scope : exp.scope;
+ ref.reference();
if (replacing) {
- def.replaced++;
+ ref.definition().replaced++;
} else {
- def.single_use = false;
+ ref.definition().single_use = false;
}
});
return node;
}, fn.argnames) === argname) {
def.reassigned = false;
var sym = make_node(AST_SymbolRef, self, argname);
- sym.reference({});
+ sym.reference();
delete argname.__unused;
return sym;
}
var def = this.definition();
for (var s = this.scope; s; s = s.parent_scope) {
push_uniq(s.enclosed, def);
- if (options.keep_fnames) {
+ if (!options) {
+ delete s._var_names;
+ } else if (options.keep_fnames) {
s.functions.each(function(d) {
push_uniq(def.scope.enclosed, d);
});