summaryrefslogtreecommitdiff
path: root/js/src/frontend/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/frontend/Parser.cpp')
-rw-r--r--js/src/frontend/Parser.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index f2d87f52be..cb84a939f6 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -7085,6 +7085,7 @@ JSOpFromPropertyType(PropertyType propType)
case PropertyType::Method:
case PropertyType::GeneratorMethod:
case PropertyType::AsyncMethod:
+ case PropertyType::AsyncGeneratorMethod:
case PropertyType::Constructor:
case PropertyType::DerivedConstructor:
return JSOP_INITPROP;
@@ -7208,7 +7209,7 @@ Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
if (propType != PropertyType::Getter && propType != PropertyType::Setter &&
propType != PropertyType::Method && propType != PropertyType::GeneratorMethod &&
- propType != PropertyType::AsyncMethod &&
+ propType != PropertyType::AsyncMethod && propType != PropertyType::AsyncGeneratorMethod &&
propType != PropertyType::Constructor && propType != PropertyType::DerivedConstructor)
{
errorAt(nameOffset, JSMSG_BAD_METHOD_DEF);
@@ -9736,6 +9737,9 @@ Parser<ParseHandler>::propertyName(YieldHandling yieldHandling,
// AsyncMethod[Yield, Await]:
// async [no LineTerminator here] PropertyName[?Yield, ?Await] ...
//
+ // AsyncGeneratorMethod[Yield, Await]:
+ // async [no LineTerminator here] * PropertyName[?Yield, ?Await] ...
+ //
// PropertyName:
// LiteralPropertyName
// ComputedPropertyName[?Yield, ?Await]
@@ -9751,7 +9755,7 @@ Parser<ParseHandler>::propertyName(YieldHandling yieldHandling,
if (!tokenStream.peekTokenSameLine(&tt))
return null();
if (tt == TOK_STRING || tt == TOK_NUMBER || tt == TOK_LB ||
- TokenKindIsPossibleIdentifierName(tt))
+ TokenKindIsPossibleIdentifierName(tt) || tt == TOK_MUL)
{
isAsync = true;
tokenStream.consumeKnownToken(tt);
@@ -9891,7 +9895,9 @@ Parser<ParseHandler>::propertyName(YieldHandling yieldHandling,
if (tt == TOK_LP) {
tokenStream.ungetToken();
- if (isGenerator)
+ if (isGenerator && isAsync)
+ *propType = PropertyType::AsyncGeneratorMethod;
+ else if (isGenerator)
*propType = PropertyType::GeneratorMethod;
else if (isAsync)
*propType = PropertyType::AsyncMethod;
@@ -10169,6 +10175,7 @@ Parser<ParseHandler>::methodDefinition(uint32_t toStringStart, PropertyType prop
case PropertyType::Method:
case PropertyType::GeneratorMethod:
case PropertyType::AsyncMethod:
+ case PropertyType::AsyncGeneratorMethod:
kind = Method;
break;
@@ -10184,11 +10191,13 @@ Parser<ParseHandler>::methodDefinition(uint32_t toStringStart, PropertyType prop
MOZ_CRASH("Parser: methodDefinition: unexpected property type");
}
- GeneratorKind generatorKind = propType == PropertyType::GeneratorMethod
+ GeneratorKind generatorKind = (propType == PropertyType::GeneratorMethod ||
+ propType == PropertyType::AsyncGeneratorMethod)
? StarGenerator
: NotGenerator;
- FunctionAsyncKind asyncKind = (propType == PropertyType::AsyncMethod)
+ FunctionAsyncKind asyncKind = (propType == PropertyType::AsyncMethod ||
+ propType == PropertyType::AsyncGeneratorMethod)
? AsyncFunction
: SyncFunction;