Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert,repl: enable ecmaVersion 2021 in acorn parser #35827

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/assert.js
Expand Up @@ -240,7 +240,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