Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
targos authored and BethGriggs committed Dec 15, 2020
1 parent a5b9418 commit a9d3a0d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/assert.js
Expand Up @@ -239,7 +239,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');
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/repl/await.js
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/repl/utils.js
Expand Up @@ -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
Expand Down

0 comments on commit a9d3a0d

Please sign in to comment.