scope = save_scope;
return true;
}
- if (node instanceof AST_SymbolRef || node instanceof AST_PropAccess) {
+ if (node instanceof AST_PropAccess
+ || node instanceof AST_SymbolRef
+ || node instanceof AST_This) {
var sym = get_symbol(node);
- if (sym instanceof AST_SymbolRef) {
+ if (sym instanceof AST_SymbolRef || node instanceof AST_This) {
lvalues[sym.name] = lvalues[sym.name] || is_lhs(node, tw.parent());
}
}
"2",
]
}
+
+issue_2364: {
+ options = {
+ collapse_vars: true,
+ pure_getters: true,
+ }
+ input: {
+ console.log(function(a) {
+ var b = a.f;
+ a.f++;
+ return b;
+ }({ f: 1 }));
+ console.log(function() {
+ var a = { f: 1 }, b = a.f;
+ a.f++;
+ return b;
+ }());
+ console.log({
+ f: 1,
+ g: function() {
+ var b = this.f;
+ this.f++;
+ return b;
+ }
+ }.g());
+ }
+ expect: {
+ console.log(function(a) {
+ var b = a.f;
+ a.f++;
+ return b;
+ }({ f: 1 }));
+ console.log(function() {
+ var a = { f: 1 }, b = a.f;
+ a.f++;
+ return b;
+ }());
+ console.log({
+ f: 1,
+ g: function() {
+ var b = this.f;
+ this.f++;
+ return b;
+ }
+ }.g());
+ }
+ expect_stdout: [
+ "1",
+ "1",
+ "1",
+ ]
+}