Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up`await` as a default parameter's name/value within a normal function nested inside an async function - what's the behavior? #987
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
isiahmeadows
Aug 30, 2017
From testing in V8, I did find that both cases returned a same-tick promise to 1.
isiahmeadows
commented
Aug 30, 2017
|
From testing in V8, I did find that both cases returned a same-tick promise to |
littledan
added
the
question
label
Aug 30, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
littledan
Aug 30, 2017
Member
V8 follows the JavaScript spec here and treats await as a simple identifier. See the definition of FunctionDeclaration, which parses parameters with the ~Await flag. As a property key, object literals generally allow any sort of keyword before the colon.
|
V8 follows the JavaScript spec here and treats |
littledan
closed this
Aug 30, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
isiahmeadows
commented
Aug 30, 2017
|
Okay, thanks! I knew there was something subtle I was probably missing. |
isiahmeadows commentedAug 30, 2017
•
edited
Two separate examples, and I can't tell if it's a spec bug or V8 bug...
My intuition is that this is valid, and
foo()should return a same-tick promise to1.My intuition is that this (and the sloppy mode equivalent) should have one of two behaviors:
awaitis used outside the function, inside the scope offoo().foo()should return a same-tick promise to1.Note that I expect sloppy mode to be similar in both cases.