diff options
-rw-r--r-- | lib/parse.js | 3 | ||||
-rw-r--r-- | test/compress/exponentiation.js | 22 | ||||
-rw-r--r-- | test/ufuzz/index.js | 3 |
3 files changed, 26 insertions, 2 deletions
diff --git a/lib/parse.js b/lib/parse.js index 7bea41d8..06f3f840 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -100,6 +100,7 @@ var OPERATORS = makePredicate([ "/=", "*=", "%=", + "**=", ">>=", "<<=", ">>>=", @@ -652,7 +653,7 @@ var UNARY_PREFIX = makePredicate("typeof void delete -- ++ ! ~ - +"); var UNARY_POSTFIX = makePredicate("-- ++"); -var ASSIGNMENT = makePredicate("= += -= /= *= %= >>= <<= >>>= |= ^= &="); +var ASSIGNMENT = makePredicate("= += -= /= *= %= **= >>= <<= >>>= |= ^= &="); var PRECEDENCE = function(a, ret) { for (var i = 0; i < a.length;) { diff --git a/test/compress/exponentiation.js b/test/compress/exponentiation.js index 5de3c964..1a678f52 100644 --- a/test/compress/exponentiation.js +++ b/test/compress/exponentiation.js @@ -43,6 +43,28 @@ await: { node_version: ">=8" } +assignment_1: { + input: { + var a = 2; + a **= 5; + console.log(a); + } + expect_exact: "var a=2;a**=5;console.log(a);" + expect_stdout: "32" + node_version: ">=8" +} + +assignment_2: { + input: { + var a = 8n; + a **= a; + console.log(a); + } + expect_exact: "var a=8n;a**=a;console.log(a);" + expect_stdout: "16777216n" + node_version: ">=10" +} + evaluate: { options = { evaluate: true, diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index c38e33c7..c90eb553 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -277,14 +277,15 @@ var ASSIGNMENTS = [ "-=", "*=", "/=", + "%=", "&=", "|=", "^=", "<<=", ">>=", ">>>=", - "%=", ]; +if (SUPPORT.exponentiation) ASSIGNMENTS.push("**="); var UNARY_SAFE = [ "+", |