Skip to content

Commit d95013f

Browse files
committed
assert,repl: enable ecmaVersion 2021 in acorn parser
This adds support for the new logical assignment operators. PR-URL: #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>
1 parent de3dcd7 commit d95013f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/assert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ function parseCode(code, offset) {
241241
// Parse the read code until the correct expression is found.
242242
do {
243243
try {
244-
node = parseExpressionAt(code, start, { ecmaVersion: 11 });
244+
node = parseExpressionAt(code, start, { ecmaVersion: 'latest' });
245245
start = node.end + 1 || start;
246246
// Find the CallExpression in the tree.
247247
node = findNodeAround(node, offset, 'CallExpression');

lib/internal/repl/await.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function processTopLevelAwait(src) {
9090
const wrappedArray = wrapped.split('');
9191
let root;
9292
try {
93-
root = parser.parse(wrapped, { ecmaVersion: 11 });
93+
root = parser.parse(wrapped, { ecmaVersion: 'latest' });
9494
} catch {
9595
return null;
9696
}

lib/internal/repl/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function isRecoverableError(e, code) {
114114
// Try to parse the code with acorn. If the parse fails, ignore the acorn
115115
// error and return the recoverable status.
116116
try {
117-
RecoverableParser.parse(code, { ecmaVersion: 11 });
117+
RecoverableParser.parse(code, { ecmaVersion: 'latest' });
118118

119119
// Odd case: the underlying JS engine (V8, Chakra) rejected this input
120120
// but Acorn detected no issue. Presume that additional text won't

0 commit comments

Comments
 (0)