aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js1
-rw-r--r--test/compress/collapse_vars.js20
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 7b871e41..a9203ce9 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1483,6 +1483,7 @@ merge(Compressor.prototype, {
function is_lhs_read_only(lhs, compressor) {
if (lhs instanceof AST_ObjectIdentity) return true;
if (lhs instanceof AST_PropAccess) {
+ if (lhs.property == "__proto__") return true;
lhs = lhs.expression;
if (lhs instanceof AST_SymbolRef) {
if (lhs.is_immutable()) return false;
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 4834dd7d..85006703 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -9151,3 +9151,23 @@ issue_4910: {
}
expect_stdout: "bar foo"
}
+
+issue_4914: {
+ options = {
+ collapse_vars: true,
+ pure_getters: "strict",
+ }
+ input: {
+ console.log(typeof function f() {
+ f.__proto__ = 42;
+ return f.__proto__;
+ }());
+ }
+ expect: {
+ console.log(typeof function f() {
+ f.__proto__ = 42;
+ return f.__proto__;
+ }());
+ }
+ expect_stdout: "function"
+}