diff --git a/lib/assert.js b/lib/assert.js index 376f4b732001bc..ffa71bfad8d412 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -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;