aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRichard van Velzen <rvanvelzen1@gmail.com>2015-01-31 13:22:07 +0100
committerRichard van Velzen <rvanvelzen1@gmail.com>2015-01-31 13:24:44 +0100
commit605362f89da444e46bae35e7f9384b5cba2eeb80 (patch)
tree192b5d82ce328f5d7b2ba1dbd43ed2e090843f29 /lib
parentfbbaa42ee55a7f753f7cab9b1a905ccf73cf26d5 (diff)
downloadtracifyjs-605362f89da444e46bae35e7f9384b5cba2eeb80.tar.gz
tracifyjs-605362f89da444e46bae35e7f9384b5cba2eeb80.zip
Drop all `console` statements properly
Because the base reference can be an member expression as well, we have to dig a bit deeper to find the leftmost base reference. Fixes #451
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/compress.js b/lib/compress.js
index ae20d485..27285984 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1873,11 +1873,16 @@ merge(Compressor.prototype, {
}
}
if (compressor.option("drop_console")) {
- if (self.expression instanceof AST_PropAccess &&
- self.expression.expression instanceof AST_SymbolRef &&
- self.expression.expression.name == "console" &&
- self.expression.expression.undeclared()) {
- return make_node(AST_Undefined, self).transform(compressor);
+ if (self.expression instanceof AST_PropAccess) {
+ var name = self.expression.expression;
+ while (name.expression) {
+ name = name.expression;
+ }
+ if (name instanceof AST_SymbolRef
+ && name.name == "console"
+ && name.undeclared()) {
+ return make_node(AST_Undefined, self).transform(compressor);
+ }
}
}
return self.evaluate(compressor)[0];
/ci.scm?id=eda3fcfb46586710fff876ce6254b300795ef543'>ci: Build Guix System images.Mathieu Othacehe 2020-05-29image: Do not use VM to create disk-images....Mathieu Othacehe 2020-05-05Merge branch 'master' into core-updatesMarius Bakke 2020-05-05image: Add a new API....Mathieu Othacehe 2020-04-08Merge branch 'master' into core-updates...Marius Bakke 2020-04-07ci: Remove "mips64el-linux-gnuabi64" from '%cross-targets'....Ludovic Courtès 2020-03-14Merge branch 'master' into core-updatesMarius Bakke 2020-03-13maint: Add 'etc/release-manifest.scm'....Ludovic Courtès 2020-03-10Merge branch 'master' into core-updatesMarius Bakke 2020-03-05ci: Adjust 'channel-build-system' for when the source is a file name....Ludovic Courtès 2020-03-05tests: "make check-system" no longer interns source upfront....Ludovic Courtès 2020-03-05ci: Move 'cross-jobs' procedure to the top level....Ludovic Courtès 2020-02-24ci: Don't cross build bootstrap tarballs to MinGW....Ludovic Courtès 2020-01-31ci: Cross-build for riscv64-linux-gnu....Ludovic Courtès 2019-12-01ci: Make sure the Guix checkout is the one providing Cuirass proc....Clément Lassieur 2019-11-13tests: "make check-system" uses Guix built with (guix self)....Ludovic Courtès 2019-08-26ci: Try hard to build package replacements....Ludovic Courtès 2019-08-14gnu: mingw: Add x86_64 support....Carl Dong 2019-07-06ci: 'channel-build-system' honors the target system....Ludovic Courtès