14.13 Labelled Statements
Syntax
A break
and continue
statements. ECMAScript has no goto
statement. A
14.13.1 Static Semantics: Early Errors
- It is a Syntax Error if any source text is matched by this production.
An alternative definition for this rule is provided in
14.13.2 Static Semantics: IsLabelledFunction ( stmt )
The abstract operation IsLabelledFunction takes argument stmt (a
- If stmt is not a
LabelledStatement , returnfalse . - Let item be the
LabelledItem of stmt. - If item is
, returnLabelledItem : FunctionDeclaration true . - Let subStmt be the
Statement of item. - Return
IsLabelledFunction (subStmt).
14.13.3 Runtime Semantics: Evaluation
- Return ?
LabelledEvaluation of thisLabelledStatement with argument « ».
14.13.4 Runtime Semantics: LabelledEvaluation
The
- Let stmtResult be
Completion (LoopEvaluation ofIterationStatement with argument labelSet). - If stmtResult is a
break completion , then- If stmtResult.[[Target]] is
empty , then- If stmtResult.[[Value]] is
empty , set stmtResult toNormalCompletion (undefined ). - Else, set stmtResult to
NormalCompletion (stmtResult.[[Value]]).
- If stmtResult.[[Value]] is
- If stmtResult.[[Target]] is
- Return ? stmtResult.
- Let stmtResult be
Completion (Evaluation ofSwitchStatement ). - If stmtResult is a
break completion , then- If stmtResult.[[Target]] is
empty , then- If stmtResult.[[Value]] is
empty , set stmtResult toNormalCompletion (undefined ). - Else, set stmtResult to
NormalCompletion (stmtResult.[[Value]]).
- If stmtResult.[[Value]] is
- If stmtResult.[[Target]] is
- Return ? stmtResult.
A
- Let label be the
StringValue ofLabelIdentifier . - Let newLabelSet be the
list-concatenation of labelSet and « label ». - Let stmtResult be
Completion (LabelledEvaluation ofLabelledItem with argument newLabelSet). - If stmtResult is a
break completion and stmtResult.[[Target]] is label, then- Set stmtResult to
NormalCompletion (stmtResult.[[Value]]).
- Set stmtResult to
- Return ? stmtResult.
- Return ?
Evaluation ofFunctionDeclaration .
- Return ?
Evaluation ofStatement .
The only two productions of