Conversation
experimental/await-ops.md
Outdated
| interface AwaitExpression <: Expression { | ||
| type: "AwaitExpression"; | ||
| argument: Expression; | ||
| operation: "all" | "any" | "race" | "allSettled" | undefined |
There was a problem hiding this comment.
To allow easy extensibility, should this be an Identifier | null so future additions won’t have to change the AST or does it make sense to strictly limit the allowed operations?
There was a problem hiding this comment.
In the typescript implementation of this (repl), it does throw an error so I think we need it to be strict.
Also in the spec, it is specified with the operation
Though I don't have strong opinion on either
There was a problem hiding this comment.
It seems to me that current spec disallows whitespace in await.all, which TypeScript implementation currently allow
await
// some comment
.all [Promise.resolve(1)]then an enum looks good to me. But I believe the spec should allow whitespaces. I have submitted tc39/proposal-await.ops#12.
If whitespaces are allowed, an Identifier | null will offer position informations for tools. We had similar discussion about that on MetaProperty (thread).
There was a problem hiding this comment.
Also agree that an enum is most appropriate here as anything other than these values would be a syntax error.
There was a problem hiding this comment.
Sorry for the wordings before. I lean to a dedicated Identifier for tracking positional information of all if whitespaces are allowed: tc39/proposal-await.ops#13
There was a problem hiding this comment.
+1 for enum. But, either way, let's remember this is an experimental PR ;)
There was a problem hiding this comment.
Updated the PR with Indentifier
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
| argument: Expression; | ||
| operation: Identifier | null | ||
| } | ||
| ``` |
There was a problem hiding this comment.
As now the operation is an Identifier, can you add a comment that the operation.name must be one of "all" | "allSettled" | "race" | "any"?
There was a problem hiding this comment.
I added an inline comment , let me know if that's okay.
reference: estree/estree#234

Added await.ops (
stage-0) toexperimentQuestion to reviewers :
Should it be just as addition to existing
AwaitExpressionor the full one that is currently being implemented.