Skip to content

Commit

Permalink
fix corner case in properties (#4889)
Browse files Browse the repository at this point in the history
fixes #4888
  • Loading branch information
alexlamsl committed Apr 30, 2021
1 parent df980db commit 8bbfaac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/compress.js
Expand Up @@ -11533,6 +11533,7 @@ merge(Compressor.prototype, {

AST_PropAccess.DEFMETHOD("flatten_object", function(key, compressor) {
if (!compressor.option("properties")) return;
if (key === "__proto__") return;
var expr = this.expression;
if (expr instanceof AST_Object) {
var props = expr.properties;
Expand Down
17 changes: 17 additions & 0 deletions test/compress/properties.js
Expand Up @@ -1446,3 +1446,20 @@ issue_4831_2: {
expect_stdout: "PASS"
node_version: ">=4"
}

issue_4888: {
options = {
properties: true,
}
input: {
console.log(typeof {
__proto__: 42,
}.__proto__);
}
expect: {
console.log(typeof {
__proto__: 42,
}.__proto__);
}
expect_stdout: "object"
}

0 comments on commit 8bbfaac

Please sign in to comment.