archives

« Bugzilla Issues Index

#4338 — 13.13.14 LabelledEvaluation: Completion value for break completions


13.13.14 Runtime Semantics: LabelledEvaluation

---
LabelledStatement : LabelIdentifier : LabelledItem
1. Let label be the StringValue of LabelIdentifier.
2. Append label as an element of labelSet.
3. Let stmtResult be LabelledEvaluation of LabelledItem with argument labelSet.
4. If stmtResult.[[type]] is break and SameValue(stmtResult.[[target]], label), then
a. If stmtResult.[[value]] is empty, let stmtResult be NormalCompletion(undefined).
b. Else, let stmtResult be NormalCompletion(stmtResult.[[value]]).
5. Return Completion(stmtResult).
---

Steps 4.a-b should be changed to:
---
a. Let stmtResult be NormalCompletion(stmtResult.[[value]]).
---

That means empty break normal completions are not changed to normal completions with value=undefined.

Reasons: Steps 4.a-b were changed in bug 4126 when other parts of the completion reform were still missing (cf. completion value for breakable statements). This is no longer necessary and the current specification is somewhat a pain to implement (it's not difficult, but nonetheless it requires some extra efforts which I don't consider to be justified).

Replacing steps 4.a-b also ensures these two statements will return the same completion value
---
L: ; // current completion value = {type=normal, value=empty}
---

And:
---
L: break L; // current completion value = {type=normal, value=undefined}
---

WDYT?


fixed in rev29 publication draft