summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2020-10-27 13:21:11 +0100
committerNode.js GitHub Bot <github-bot@iojs.org>2020-10-30 14:52:28 +0000
commit0ddd69e2eddc415105d099f614c676efe1f886c3 (patch)
treedeebd9aad756e763caa075fe7fecd2e367a1ad49
parent87a6b601325358d43ea9b649144417d3532ac58f (diff)
downloadnode-new-0ddd69e2eddc415105d099f614c676efe1f886c3.tar.gz
assert,repl: enable ecmaVersion 2021 in acorn parser
This adds support for the new logical assignment operators. PR-URL: https://github.com/nodejs/node/pull/35827 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
-rw-r--r--lib/assert.js2
-rw-r--r--lib/internal/repl/await.js2
-rw-r--r--lib/internal/repl/utils.js2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/assert.js b/lib/assert.js
index 415ac30775..43209df18f 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -241,7 +241,7 @@ function parseCode(code, offset) {
// Parse the read code until the correct expression is found.
do {
try {
- node = parseExpressionAt(code, start, { ecmaVersion: 11 });
+ node = parseExpressionAt(code, start, { ecmaVersion: 'latest' });
start = node.end + 1 || start;
// Find the CallExpression in the tree.
node = findNodeAround(node, offset, 'CallExpression');
diff --git a/lib/internal/repl/await.js b/lib/internal/repl/await.js
index 7bfdcb894f..da6c7a3a17 100644
--- a/lib/internal/repl/await.js
+++ b/lib/internal/repl/await.js
@@ -90,7 +90,7 @@ function processTopLevelAwait(src) {
const wrappedArray = wrapped.split('');
let root;
try {
- root = parser.parse(wrapped, { ecmaVersion: 11 });
+ root = parser.parse(wrapped, { ecmaVersion: 'latest' });
} catch {
return null;
}
diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js
index 7d68e5e4d9..058f262b5a 100644
--- a/lib/internal/repl/utils.js
+++ b/lib/internal/repl/utils.js
@@ -114,7 +114,7 @@ function isRecoverableError(e, code) {
// Try to parse the code with acorn. If the parse fails, ignore the acorn
// error and return the recoverable status.
try {
- RecoverableParser.parse(code, { ecmaVersion: 11 });
+ RecoverableParser.parse(code, { ecmaVersion: 'latest' });
// Odd case: the underlying JS engine (V8, Chakra) rejected this input
// but Acorn detected no issue. Presume that additional text won't