Skip to content

[parser] Support BigIntLiteral in visitMemberKey - #560

Merged
Liedtke merged 1 commit into
googleprojectzero:mainfrom
CSharperMantle:fix-parserjs-bigintlit-key
Sep 16, 2026
Merged

Liedtke merged 1 commit into
googleprojectzero:mainfrom
CSharperMantle:fix-parserjs-bigintlit-key

Conversation

@CSharperMantle

Copy link
Copy Markdown
Contributor

Currently, when trying to parse the following program using parser.js:

({1n: 0});
class C { 1n(){} }
for (const {1n: x} of [{}]) {}

... this exception is thrown:

$ node parser.js ../../Protobuf/ast.proto /tmp/demo.js /dev/null

/home/csmantle/workspace/fuzzilli/Sources/Fuzzilli/Compiler/Parser/parser.js:263
                throw "Unknown member key type: " + member.key.type + " in declaration";
                ^
Unknown member key type: BigIntLiteral in declaration
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v26.8.2

Similar BigInt-keyed patterns are also found in SpiderMonkey's js/src/jit-test/tests/1659595.js.

visitExpression in parser.js already handles the BigIntLiteral type; thus, fix up the visitMemberKey handling similarly.

case 'BigIntLiteral': {
return makeExpression('BigIntLiteral', { value: node.value });
}

This fix would enable correct parsing of all three patterns mentioned above.

CSharperMantle added a commit to CSharperMantle/googleprojectzero-fuzzilli that referenced this pull request Sep 15, 2026
This enables parsing of BigIntLiteral-keyed properties, methods, and
destructuring bindings, for example:

        ({1n: 0});
        class C { 1n(){} }
        for (const {1n: x} of [{}]) {}

Link: googleprojectzero#560
Comment thread Sources/Fuzzilli/Compiler/Parser/parser.js
@CSharperMantle
CSharperMantle force-pushed the fix-parserjs-bigintlit-key branch from fd2cce4 to 1cc4f6c Compare September 16, 2026 02:15
This enables parsing of BigIntLiteral-keyed properties, methods, and
destructuring bindings, for example:

        ({1n: 0});
        class C { 1n(){} }
        for (const {1n: x} of [{}]) {}
@CSharperMantle
CSharperMantle force-pushed the fix-parserjs-bigintlit-key branch from 1cc4f6c to 91cd655 Compare September 16, 2026 02:19
CSharperMantle added a commit to CSharperMantle/googleprojectzero-fuzzilli that referenced this pull request Sep 16, 2026
This enables parsing of BigIntLiteral-keyed properties, methods, and
destructuring bindings, for example:

        ({1n: 0});
        class C { 1n(){} }
        for (const {1n: x} of [{}]) {}

Link: googleprojectzero#560

@Liedtke Liedtke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

@Liedtke
Liedtke merged commit 5468074 into googleprojectzero:main Sep 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants