assert: use new language features
This adds new language features to acorn. Otherwise BigInt and other input would not be parsed correct and would not result in nice error messages when using simple assert. PR-URL: https://github.com/nodejs/node/pull/27400 Refs: https://github.com/nodejs/node/issues/27391 Refs: https://github.com/nodejs/node/issues/25835 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
72c6ea2683
commit
04b7c007d6
@ -203,8 +203,27 @@ function getCode(fd, line, column) {
|
||||
function parseCode(code, offset) {
|
||||
// Lazy load acorn.
|
||||
if (parseExpressionAt === undefined) {
|
||||
({ parseExpressionAt } = require('internal/deps/acorn/acorn/dist/acorn'));
|
||||
const acorn = require('internal/deps/acorn/acorn/dist/acorn');
|
||||
const privateMethods =
|
||||
require('internal/deps/acorn-plugins/acorn-private-methods/index');
|
||||
const bigInt = require('internal/deps/acorn-plugins/acorn-bigint/index');
|
||||
const classFields =
|
||||
require('internal/deps/acorn-plugins/acorn-class-fields/index');
|
||||
const numericSeparator =
|
||||
require('internal/deps/acorn-plugins/acorn-numeric-separator/index');
|
||||
const staticClassFeatures =
|
||||
require('internal/deps/acorn-plugins/acorn-static-class-features/index');
|
||||
|
||||
({ findNodeAround } = require('internal/deps/acorn/acorn-walk/dist/walk'));
|
||||
|
||||
const Parser = acorn.Parser.extend(
|
||||
privateMethods,
|
||||
bigInt,
|
||||
classFields,
|
||||
numericSeparator,
|
||||
staticClassFeatures
|
||||
);
|
||||
parseExpressionAt = Parser.parseExpressionAt.bind(Parser);
|
||||
}
|
||||
let node;
|
||||
let start = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user