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

Possibly-unreachable specification text #299

Closed
jugglinmike opened this Issue Jan 19, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@jugglinmike
Contributor

jugglinmike commented Jan 19, 2016

I'm having trouble verifying step 4.a.ii.1 in section 13.12.9 ("Runtime Semantics: CaseBlockEvaluation"):

CaseBlock : { CaseClauses }

1. Let V = undefined.
2. Let A be the List of CaseClause items in CaseClauses, in source text order.
3. Let found be false.
4. Repeat for each CaseClause C in A,
   a. If found is false, then
      i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
      ii. If clauseSelector is an abrupt completion, then
          1. If clauseSelector.[[value]] is empty, return
             Completion{[[type]]: clauseSelector.[[type]], [[value]]:
             undefined, [[target]]: clauseSelector.[[target]]}.

source: http://www.ecma-international.org/ecma-262/6.0/#sec-runtime-semantics-caseblockevaluation

(The algorithm for blocks containing the default case have an equivalent step.)

Because CaseSelectorEvaluation is defined as follows:

CaseClause : case Expression : StatementListopt

1. Let exprRef be the result of evaluating Expression.
2. Return GetValue(exprRef).

...the question I'm having trouble answering is: which Expression will return an empty abrupt completion?

@anba

This comment has been minimized.

Show comment
Hide comment
@anba

anba Jan 19, 2016

Contributor

These steps were initially added to support do-expressions, but currently they aren't needed (and got removed in 748ec83).

Contributor

anba commented Jan 19, 2016

These steps were initially added to support do-expressions, but currently they aren't needed (and got removed in 748ec83).

@jugglinmike

This comment has been minimized.

Show comment
Hide comment
@jugglinmike

jugglinmike Jan 19, 2016

Contributor

@anba Thank you!

Contributor

jugglinmike commented Jan 19, 2016

@anba Thank you!

@anba

This comment has been minimized.

Show comment
Hide comment
@anba

anba Jan 19, 2016

Contributor

(BTW there is a similar issue in CreatePerIterationEnvironment: lastIterationEnvRec.GetBindingValue can never return an abrupt completion in ES2015/2016. The call to ReturnIfAbrupt was only added to handle this case: for (let x = do { continue; }; ;) {}. )

Contributor

anba commented Jan 19, 2016

(BTW there is a similar issue in CreatePerIterationEnvironment: lastIterationEnvRec.GetBindingValue can never return an abrupt completion in ES2015/2016. The call to ReturnIfAbrupt was only added to handle this case: for (let x = do { continue; }; ;) {}. )

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