mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Issue #1918 - m-c 1353693: Correct parsing of async generator methods
This commit is contained in:
parent
a511ff812e
commit
e9cc7313ac
2 changed files with 15 additions and 5 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -579,6 +579,7 @@ enum class PropertyType {
|
|||
Method,
|
||||
GeneratorMethod,
|
||||
AsyncMethod,
|
||||
AsyncGeneratorMethod,
|
||||
Constructor,
|
||||
DerivedConstructor
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue