aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-10-17 01:18:55 +0800
committerGitHub <noreply@github.com>2017-10-17 01:18:55 +0800
commitfe647b083e0def2bf6445534c7017baed09541a9 (patch)
tree6a78e6d789d7bb39391cf8c0f9ea7cf9bf4c3e9e /lib/compress.js
parentdfe4f6c6de3971e48b6a5a807e17314d65cdc9b5 (diff)
downloadtracifyjs-fe647b083e0def2bf6445534c7017baed09541a9.tar.gz
tracifyjs-fe647b083e0def2bf6445534c7017baed09541a9.zip
account for side-effects from `AST_This` in `collapse_vars` (#2365)
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index c3876f9d..5e391aba 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -950,9 +950,11 @@ merge(Compressor.prototype, {
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());
}
}