Editorial: Factor out AO RunSuspendedContext()#2664
Conversation
e3e0a00 to
2586002
Compare
2586002 to
1bb271e
Compare
1bb271e to
4e953c2
Compare
4e953c2 to
fe05833
Compare
| 1. Push _asyncContext_ onto the execution context stack; _asyncContext_ is now the running execution context. | ||
| 1. <emu-meta effects="user-code">Resume the suspended evaluation of _asyncContext_</emu-meta> using NormalCompletion(_value_) as the result of the operation that suspended it. | ||
| 1. Assert: When we reach this step, _asyncContext_ has already been removed from the execution context stack and _prevContext_ is the currently running execution context. | ||
| 1. Perform Completion(RunSuspendedContext(_asyncContext_, NormalCompletion(_value_))). |
There was a problem hiding this comment.
Yes it does, e.g.: error: RunSuspendedContext returns a Completion Record, but is not consumed as if it does (typecheck) at spec.html:46018:24
ed3013c to
4cfe666
Compare
|
This PR's |
4cfe666 to
a05d197
Compare
a05d197 to
c6bc612
Compare
c6bc612 to
27a2df5
Compare
27a2df5 to
98d3b24
Compare
98d3b24 to
308349d
Compare
|
I know that a few years ago there was some opposition to this, but I think it's a good change. It's a somewhat complex set of steps, and a reader should be able to easily tell that in all those places the spec is doing exactly the same thing. |
gibson042
left a comment
There was a problem hiding this comment.
I'm also in favor of this change, and the sequence of commits makes its editorial nature clear.
|
As requested at today's editor call: To summarize:
I'm not entirely happy with the names of the proposed AOs. They're mostly based on existing terminology, which has issues. In particular, (Note that PR #2962 changes some of the terminology, including scrapping the idea of "suspending" and "resuming" execution contexts.) |
| 1. Push _asyncContext_ onto the execution context stack; _asyncContext_ is now the running execution context. | ||
| 1. <emu-meta effects="user-code">Resume the suspended evaluation of _asyncContext_</emu-meta> using NormalCompletion(_v_) as the result of the operation that suspended it. | ||
| 1. Assert: When we reach this step, _asyncContext_ has already been removed from the execution context stack and _prevContext_ is the currently running execution context. | ||
| 1. Perform Completion(RunSuspendedContext(_asyncContext_, NormalCompletion(_v_))). |
There was a problem hiding this comment.
I think we need to give an explicit NOTE that this completion record is intentionally ignored. Same below.
There was a problem hiding this comment.
Done. It's also ignored in AsyncGeneratorResume; would you like the same Note there?
There was a problem hiding this comment.
In AsyncGeneratorResume, it's not ignored, it's asserted to be normal. So I think we only need the note here.
308349d to
3e5f088
Compare
|
The rendered spec preview for this PR is available as a single page at https://tc39.es/ecma262/pr/2664 and as multiple pages at https://tc39.es/ecma262/pr/2664/multipage . |
|
@jmdyck Either is fine, but separate is probably better to make the review process simpler. |
c9d6aab to
f36acf9
Compare
f36acf9 to
875e880
Compare
875e880 to
e07ec27
Compare
This doesn't address the semantics of Suspend/Resume, just factors out a common chunk of code.
This PR is split into 6 commits where it's easier to confirm the correctness. They're probably fine to be squashed before landing.