Non-octal decimal integer literal is still mistakenly allowed in strict mode #1731

ariya opened this Issue Jan 17, 2017 · 0 comments


None yet

1 participant

ariya commented Jan 17, 2017

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 ::
    0 NonOctalDigit

NonOctalDigit :: one of
    8 9

This restriction is now implemented in V8, see

According to V8 error messages, the exception message should be "Decimals with leading zeros are not allowed in strict mode".

@ariya ariya added the es6 label Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment