Skip to content
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

inadequate .[[Value]] after ReturnIfAbrupt in 15.2.1.20 #936

Closed
kotarondo opened this issue Jun 17, 2017 · 4 comments
Closed

inadequate .[[Value]] after ReturnIfAbrupt in 15.2.1.20 #936

kotarondo opened this issue Jun 17, 2017 · 4 comments
Labels
completion records Relates to completion records, and ? / ! notation.

Comments

@kotarondo
Copy link

In the following Evaluation algorithm, sl.[[Value]] in the last line should be sl because sl is already a completion's [[Value]] after ReturnIfAbrupt(sl).

15.2.1.20 Runtime Semantics: Evaluation
ModuleItemList: ModuleItemList ModuleItem
 1. Let sl be the result of evaluating ModuleItemList.
 2. ReturnIfAbrupt(sl).
 3. Let s be the result of evaluating ModuleItem.
 4. Return Completion(UpdateEmpty(s, sl.[[Value]])).
@ljharb
Copy link
Member

ljharb commented Jun 17, 2017

Doesn't ReturnIfAbrupt(sl) become the value? I don't think it mutates the fictional sl binding.

@kotarondo
Copy link
Author

The Definition of ReturnIfAbrupt:

5.2.3.3 ReturnIfAbrupt
Algorithms steps that say or are otherwise equivalent to:

ReturnIfAbrupt(argument).
mean the same thing as:

If argument is an abrupt completion, return argument.
Else if argument is a Completion Record, let argument be argument.[[Value]].

In above case, step 2 means:

If sl is an abrupt completion, return sl.
Else if sl is a Completion Record, let sl be sl.[[Value]].

@ljharb
Copy link
Member

ljharb commented Jun 17, 2017

Ah, fair point. That seems like a confusing way for the spec to be worded, but given that, I think you are correct.

@jmdyck
Copy link
Collaborator

jmdyck commented Jun 18, 2017

That seems like a confusing way for the spec to be worded

(I think it would be less confusing with the proposal of Issue #497.)

@ljharb ljharb added the completion records Relates to completion records, and ? / ! notation. label Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completion records Relates to completion records, and ? / ! notation.
Projects
None yet
Development

No branches or pull requests

3 participants