if (parent instanceof AST_Call && node === parent.expression) return;
if (parent instanceof AST_Sequence && node !== parent.tail_node()) return;
if (parent instanceof AST_SimpleStatement) return;
- if (parent instanceof AST_Unary) return;
+ if (parent instanceof AST_Unary && !unary_side_effects[parent.operator]) return;
d.direct_access = true;
}
}));
return make_sequence(node, assignments);
}
+ if (node instanceof AST_Unary
+ && !unary_side_effects[node.operator]
+ && node.expression instanceof AST_SymbolRef
+ && node.expression.definition().id in defs_by_id) {
+ node = node.clone();
+ node.expression = make_node(AST_Object, node, {
+ properties: []
+ });
+ return node;
+ }
if (node instanceof AST_VarDef && can_hoist(node.name, node.value, 0)) {
descend(node, this);
var defs = new Dictionary();