New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"do{;}while(false)false" prohibited in spec but allowed in consensus reality #684

Closed
littledan opened this Issue Sep 7, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@littledan
Member

littledan commented Sep 7, 2016

This bug is following up on an earlier bug in the old tracker. I just checked, and the syntax is still allowed in Chrome and Firefox. Any thoughts on whether this should be standardized? I don't have any data on how often it's used, but it seems useful for minimizers. in V8, the syntax has been allowed since inception, with the following comment in the code from 2008:

// Allow do-statements to be terminated with and without
// semi-colons. This allows code such as 'do;while(0)return' to
// parse, which would not be the case if we had used the
// ExpectSemicolon() functionality here.

I think the grammar change would be as simple as leaving off the semicolon at the end of IterationStatement. Thoughts? cc @erights who filed the original bug.

@bterlson

This comment has been minimized.

Show comment
Hide comment
@bterlson

bterlson Sep 7, 2016

Member

FWIW it also parses in Chakra and JSC. But isn't this just ASI semantics? ASI calls out this case specifically in bullet 1.3 (https://tc39.github.io/ecma262/#sec-rules-of-automatic-semicolon-insertion).

Member

bterlson commented Sep 7, 2016

FWIW it also parses in Chakra and JSC. But isn't this just ASI semantics? ASI calls out this case specifically in bullet 1.3 (https://tc39.github.io/ecma262/#sec-rules-of-automatic-semicolon-insertion).

@littledan

This comment has been minimized.

Show comment
Hide comment
@littledan

littledan Sep 7, 2016

Member

Oh, my mistake, it's right there.

Member

littledan commented Sep 7, 2016

Oh, my mistake, it's right there.

@littledan littledan closed this Sep 7, 2016

@erights

This comment has been minimized.

Show comment
Hide comment
@erights

erights Sep 7, 2016

Yup. I just checked https://es5.github.io/#x7.9.1 and this third bullet is new; presumably to close exactly this bug.

erights commented Sep 7, 2016

Yup. I just checked https://es5.github.io/#x7.9.1 and this third bullet is new; presumably to close exactly this bug.

@allenwb

This comment has been minimized.

Show comment
Hide comment
@allenwb

allenwb Sep 7, 2016

Member

Also see Annex E entry for 11.9.1.

Member

allenwb commented Sep 7, 2016

Also see Annex E entry for 11.9.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment