Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Sources/Fuzzilli/Compiler/Parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ function parse(script, proto) {
body.index = member.key.value;
} else if (member.key.type === 'StringLiteral') {
body.name = member.key.value;
} else if (member.key.type === 'BigIntLiteral') {
body.name = member.key.value;
Comment thread
Liedtke marked this conversation as resolved.
} else if (member.key.type === 'PrivateName') {
assert(member.key.id.type === 'Identifier', "Expected private name ID to be an Identifier");
body.privateName = member.key.id.name;
Expand Down
33 changes: 33 additions & 0 deletions Tests/FuzzilliTests/CompilerTests/bigint_literal_prop_keys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
if (typeof output === "undefined") output = console.log;

const obj1 = { 42n: 42 };
output(obj1[42n]);
output(obj1["42"]);
output(Object.keys(obj1).length);

const obj2 = { 1: 1, 1n: 2n, "1": "3" };
output(Object.keys(obj2).length);
output(obj2[1n]);

const obj3 = {
get 3n() {
return 3;
},
set 3n(v) {},
};
obj3[3n] = 42;
output(obj3[3n]);

class C {
static 2n() {
return 2;
}
1n() {
return 1;
}
}
output(C[2n]());
output(new C()[1n]());

let { 1n: x } = { 1n: "big" };
output(x);