Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAnnex B 3: FunctionDeclaration in LabelledStatement in, e.g., IterationStatement? #480
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
littledan
Mar 17, 2016
Member
Thanks @allenwb ! That resolves it; I guess this is the same as my first option.
|
Thanks @allenwb ! That resolves it; I guess this is the same as my first option. |
littledan
closed this
Mar 17, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
syg
Sep 26, 2017
Member
All of Firefox, Chrome, Safari, and Edge currently still allow labelled function declarations under if, with, and loop statements in sloppy mode.
Do we know for sure if this is web compatible? I strongly suspect yes, but it seems like we still don't know.
Please re-close if there is an actual shipping implementation of this.
|
All of Firefox, Chrome, Safari, and Edge currently still allow labelled function declarations under if, with, and loop statements in sloppy mode. Do we know for sure if this is web compatible? I strongly suspect yes, but it seems like we still don't know. Please re-close if there is an actual shipping implementation of this. |
syg
reopened this
Sep 26, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I completely tested the wrong thing, and I am sorry for alerting people. |
littledan commentedMar 17, 2016
With all of Annex B 3 in effect, it seems like the syntax permits statements like this in sloppy mode:
This is based on Annex B 3.2 https://tc39.github.io/ecma262/#sec-functiondeclarations-in-ifstatement-statement-clauses, which permits FunctionDeclarations as the LabelledItem in a LabelledStatement in sloppy mode. LabelledStatements are Statements, so they are permitted as the body of an IterationStatement.
What are the semantics of such a usage? The only guide I see is Annex B 3.4 https://tc39.github.io/ecma262/#sec-functiondeclarations-in-ifstatement-statement-clauses which says that FunctionDeclarations as the body of an IfStatement act like they are enclosed in a block. But I don't see any of this logic for LabelledStatements.
I see a couple possibilities:
Based on the general design of Annex B, trying to be minimal, I think we might want to go with the first option. Thoughts?
@bterlson @allenwb @jugglinmike