}
return node;
}
- if (drop_vars && assign_as_unused) {
- var n = node;
- while (n instanceof AST_Assign
- && n.operator == "="
- && n.left instanceof AST_SymbolRef) {
- var def = n.left.definition();
- if (def.id in in_use_ids
- || self.variables.get(def.name) !== def) break;
- n = n.right;
+ if (drop_vars && assign_as_unused
+ && node instanceof AST_Assign
+ && node.operator == "="
+ && node.left instanceof AST_SymbolRef) {
+ var def = node.left.definition();
+ if (!(def.id in in_use_ids)
+ && self.variables.get(def.name) === def) {
+ return maintain_this_binding(tt.parent(), node, node.right.transform(tt));
}
- if (n !== node) return n;
}
if (node instanceof AST_For) {
descend(node, this);