[Webkit-unassigned] [Bug 156147] [JSC] implement async functions proposal
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun May 1 09:04:00 PDT 2016
--- Comment #66 from Yusuke Suzuki <utatane.tea at gmail.com> ---
Comment on attachment 277702
View in context: https://bugs.webkit.org/attachment.cgi?id=277702&action=review
Second round. I'll look into the parser changes next :)
> + let value = @undefined;
if (typeof state !== 'number')
throw new @TypeError("|this| should be an async function");
>>> +await AWAIT
>> Are async and await keywords? I think they are contextual keywords, correct?
> A number of versions ago, they were treated as contextual keywords (and tokenized as IDENTs) --- but they are checked in so many contexts, that it seems worthwhile to internalize them and tokenize them separately from identifiers --- It may be a close call, but I think when the flag is enabled, it makes more sense to do this.
> Contexts where `async` is potentially a keyword include any PrimaryExpression, any AssignmentExpression, and any StatementListItem (including in module code) --- nearly anywhere a BindingIdentifier is expected.
> For `await`, it might make a bit more sense to use `matchContextualKeyword`, though, you're right.
> Thanks for taking a look at this, I appreciate it Yusuke :)
I have some concerns about adding "async" and "await" into this keyword category.
Currently, Keywords.table only holds keywords. Adding (strictly speaking)non-keyword words into this table seems confusing to readers.
For example, "eval", "arguments" are handled like keywords under the strict mode, but it is not included in this table.
"async" is so widely accepted word. So "async" is frequently used as a variable, a method name, a parameter etc.
If we don't include "async" in IDENT, once we use "IDENT" in the current parser, we easily miss "async" word, and it will break many pages.
Seeing http://tc39.github.io/ecmascript-asyncawait/#identifier-static-semantics-early-errors, "await" can be introduced into the keywords.
But this handling does not include "async". I think it is better that "async" is handled in IDENT at least.
> + AllowAwaitOverride allowAwait(this, !isAsyncFunctionParseMode(mode));
Nice. We can use SetForScope here :)
> source, name.string(), SourceCodeKey::FunctionType,
We need to add RuntimeFlats into SourceCodeKey.
> + if (isAsyncFunctionParseMode(metadata->parseMode()))
Let's add generator and arrow function cases here.
> + putDirectWithoutTransition(vm, vm.propertyNames->AsyncFunction, asyncFunctionConstructor, DontEnum);
AsyncFunction constructor is not exposed as a global variable. (It is the same to the GeneratorFunction constructor).
"... and the initial value of the Object property of the global object."
"... and the initial value of the Array property of the global object."
But, GeneratorFunction constructor and AsyncFunction constructor do not have such statements.
> +shouldBeAsync("barley", () => e.y("ley"));
Let's move these tests to tests/stress directory. es6 is used for kangax's compat-table tests.
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-unassigned