`({ 1n: 1 })` should not throw syntax error
Categories
(Core :: JavaScript Engine, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: public, Assigned: anba)
References
Details
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
Steps to reproduce:
Run a JavaScript code ({ 1n: 1 })
Actual results:
SyntaxError: expected property name, got bigint literal
Expected results:
It makes an object { 1: 1 }
.
PropertyName contains BigInt literals. And I couldn't find any early errors for BigInt literals.
As the Evaluation section, if a property name is a numeric literal, the property name should be ToString
of the numeric value.
Hi, Toru Nagashima!
Thanks for your contribution!
I don't have deep knowledge in JavaScript but I've checked according to the steps described with one of the devs here and we are receiving the same message on firefox and chrome. If this is not the intended or expected behavior, please respond to the thread here so we keep investigating.
Please let us know if this issue is reproduced in the latest Nightly edition. You can download it from here: https://nightly.mozilla.org/
Once you have all this information, please let us know so we can continue investigating.
Regards,
Assignee | ||
Comment 4•6 years ago
|
||
Clearing NI because this is a valid bug, it just happens to be a bug present in both Firefox and Chrome.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 5•6 years ago
|
||
BytecodeEmitter.cpp:
ParseNode::getConstantValue
directly callsBigIntLiteral::value()
to match the
existing use in that function. This is incompatible with deferred gc-things
allocation, but doesn't matter in practice, because this all happens in dead code
anyway.- Drive-by change in
emitObjLiteralValue()
: Call MOZ_CRASH instead of returning
false
for unhandled parse nodes. And also assert the function is only called
with valid parse nodes in the first place.
NameFunctions.cpp:
- BigInts aren't currently supported for guessed names, so just I've only updated
the assertion condition.
Parser.cpp:
- Update spec reference from
NumericLiteralBase
toNonDecimalIntegerLiteral
. - The new
bigIntAtom()
function runs counter to the deferred gc-things work,
but this inevitable as long as function names are computed in the parser.
Updated•6 years ago
|
Comment 7•6 years ago
|
||
Backed out changeset 66693433b026 (bug 1605835) for jsreftest failures at property-name-guessed-name.js.
https://hg.mozilla.org/integration/autoland/rev/48e01247b97523ce4ba7b0f35381385030ccc16f
Failure log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=284235525&repo=autoland&lineNumber=2664
Assignee | ||
Comment 8•6 years ago
|
||
It looks like the displayName
testing function can't unwrap wrappers.
Comment 10•6 years ago
|
||
bugherder |
Updated•5 years ago
|
Description
•