Non-octal decimal integer literal is still mistakenly allowed in strict mode
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 773
- PR merge metrics
- No merged PRs in 30d
Description
Test case:
esprima.parse('"use strict"; 08')
Actual: A syntax tree.
Expected. A thrown exception indicating that the source is not valid.
In the ES2015 specification, §B.1.1 Numeric Literals, it is mentioned:
The syntax and semantics of 11.8.3 is extended as follows except that this extension is not allowed for strict mode code:
The relevant productions are:
DecimalIntegerLiteral ::
NonOctalDecimalIntegerLiteral
NonOctalDecimalIntegerLiteral ::
0 NonOctalDigit
NonOctalDigit :: one of
8 9
This restriction is now implemented in V8, see https://bugs.chromium.org/p/v8/issues/detail?id=4973.
According to V8 error messages, the exception message should be "Decimals with leading zeros are not allowed in strict mode".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the esprima.parse entry point and reproduce the strict-mode input "use strict"; 08. Trace how numeric literals are parsed in strict mode and make completion produce the expected exception rather than a syntax tree. Confirm the behavior against the supplied test case and expected error message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100