archives

« Bugzilla Issues Index

#4540 — Completion reform is incomplete


Completion values have not been reformed properly for `if` and `with` statements:

- 13.6.7 step 6: The ReturnIfAbrupt will not replace the empty value of a `break` completion with undefined.

- 13.11.7 step 10: This only replaces the empty value of a `normal` completion, but not of a `break`.

Consequently, examples like the following still have dynamic behaviour:

666;
l: if (condition) {
42; break l;
} else {
break l;
}
// completion value here is 666 if condition is false; should be undefined

666;
l: with ({}) {
break l;
}
// completion value is 666, not undefined

The spec seems correct for all other statements, e.g.

666;
while (true) {
break;
}
// completion value is undefined


Closely related bug: https://bugs.ecmascript.org/show_bug.cgi?id=4541


Fixed in ES2016 Draft.