4629bff7e9
Add a syntactic diagnostic for extension type augmentations that declare representation fields. Extension type augmentations may augment the declaration, but they must not redeclare the representation. Thread an explicit parser option through primary constructor parsing so extension type augmentations can omit a representation without producing the usual missing-primary-constructor diagnostics, while still reporting an error when a representation is present. Register the new diagnostic in the shared and analyzer generated diagnostic tables and add it to fix status tracking. Change-Id: I84815bb0669a76126564e590760e93096a3af046 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505860 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Paul Berry <paulberry@google.com> SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
213 lines
13 KiB
Plaintext
213 lines
13 KiB
Plaintext
parseUnit(macro)
|
|
skipErrorTokens(macro)
|
|
listener: beginCompilationUnit(macro)
|
|
syntheticPreviousToken(macro)
|
|
parseTopLevelDeclarationImpl(, DirectiveContext(DirectiveState.Unknown))
|
|
parseMetadataStar()
|
|
listener: beginMetadataStar(macro)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelMemberImpl()
|
|
listener: beginTopLevelMember(macro)
|
|
isReservedKeyword(class)
|
|
indicatesMethodOrField(Class)
|
|
parseFields(, null, null, null, null, null, null, null, , NoType(), macro, DeclarationKind.TopLevel, null, false)
|
|
listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, )
|
|
reportRecoverableError(macro, MissingConstFinalVarOrType)
|
|
listener: handleRecoverableError(MissingConstFinalVarOrType, macro, macro)
|
|
listener: handleNoType()
|
|
ensureIdentifierPotentiallyRecovered(, topLevelVariableDeclaration, false)
|
|
listener: handleIdentifier(macro, topLevelVariableDeclaration)
|
|
parseFieldInitializerOpt(macro, macro, null, null, null, null, null, DeclarationKind.TopLevel, null)
|
|
listener: handleNoFieldInitializer(class)
|
|
ensureSemicolon(macro)
|
|
reportRecoverableError(macro, Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}])
|
|
listener: handleRecoverableError(Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}], macro, macro)
|
|
rewriter()
|
|
listener: endTopLevelFields(null, null, null, null, null, null, null, 1, macro, ;)
|
|
listener: endTopLevelDeclaration(;)
|
|
parseTopLevelDeclarationImpl(;, DirectiveContext(DirectiveState.Declarations))
|
|
parseMetadataStar(;)
|
|
listener: beginMetadataStar(class)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelKeywordDeclaration(class, ;, class, null, null, null, DirectiveContext(DirectiveState.Declarations))
|
|
parseClassOrNamedMixinApplication(class, null, null, null, null, null, null, null, class)
|
|
listener: beginClassOrMixinOrNamedMixinApplicationPrelude(class)
|
|
ensureIdentifier(class, classOrMixinDeclaration)
|
|
listener: handleIdentifier(Class, classOrMixinDeclaration)
|
|
listener: handleNoTypeVariables({)
|
|
listener: beginClassDeclaration(class, null, null, null, null, null, null, null, Class)
|
|
parseClass(Class, class, class, null, Class)
|
|
parsePrimaryConstructorOpt(DeclarationKind.Class, Class, null, allowExtensionTypeRepresentation: true)
|
|
listener: handleNoPrimaryConstructor(DeclarationKind.Class, Class, null)
|
|
parseClassHeaderOpt(Class, class, class)
|
|
parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
|
|
listener: handleNoType(Class)
|
|
listener: handleClassExtends(null, 1)
|
|
parseClassWithClauseOpt(Class)
|
|
listener: handleClassNoWithClause()
|
|
parseClassOrMixinOrEnumImplementsOpt(Class)
|
|
listener: handleImplements(null, 0)
|
|
listener: handleClassHeader(class, class, null)
|
|
parseClassOrMixinOrExtensionBody(Class, DeclarationKind.Class, Class)
|
|
listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
|
|
notEofOrType(CLOSE_CURLY_BRACKET, })
|
|
listener: endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
|
|
listener: endClassDeclaration(class, })
|
|
listener: endTopLevelDeclaration(})
|
|
parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations))
|
|
parseMetadataStar(})
|
|
listener: beginMetadataStar(abstract)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelMemberImpl(})
|
|
listener: beginTopLevelMember(abstract)
|
|
isReservedKeyword(class)
|
|
indicatesMethodOrField(Class)
|
|
reportRecoverableErrorWithToken(abstract, Template(ExtraneousModifier))
|
|
listener: handleRecoverableError(Message[Template(ExtraneousModifier), Can't have modifier 'abstract' here., Try removing 'abstract'., {lexeme: abstract}], abstract, abstract)
|
|
parseFields(}, abstract, null, null, null, null, null, null, abstract, NoType(), macro, DeclarationKind.TopLevel, null, false)
|
|
listener: beginFields(DeclarationKind.TopLevel, null, abstract, null, null, null, null, null, })
|
|
reportRecoverableError(macro, MissingConstFinalVarOrType)
|
|
listener: handleRecoverableError(MissingConstFinalVarOrType, macro, macro)
|
|
listener: handleNoType(abstract)
|
|
ensureIdentifierPotentiallyRecovered(abstract, topLevelVariableDeclaration, false)
|
|
listener: handleIdentifier(macro, topLevelVariableDeclaration)
|
|
parseFieldInitializerOpt(macro, macro, null, abstract, null, null, null, DeclarationKind.TopLevel, null)
|
|
listener: handleNoFieldInitializer(class)
|
|
ensureSemicolon(macro)
|
|
reportRecoverableError(macro, Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}])
|
|
listener: handleRecoverableError(Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}], macro, macro)
|
|
rewriter()
|
|
listener: endTopLevelFields(null, abstract, null, null, null, null, null, 1, abstract, ;)
|
|
listener: endTopLevelDeclaration(;)
|
|
parseTopLevelDeclarationImpl(;, DirectiveContext(DirectiveState.Declarations))
|
|
parseMetadataStar(;)
|
|
listener: beginMetadataStar(class)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelKeywordDeclaration(class, ;, class, null, null, null, DirectiveContext(DirectiveState.Declarations))
|
|
parseClassOrNamedMixinApplication(class, null, null, null, null, null, null, null, class)
|
|
listener: beginClassOrMixinOrNamedMixinApplicationPrelude(class)
|
|
ensureIdentifier(class, classOrMixinDeclaration)
|
|
listener: handleIdentifier(Class, classOrMixinDeclaration)
|
|
listener: handleNoTypeVariables({)
|
|
listener: beginClassDeclaration(class, null, null, null, null, null, null, null, Class)
|
|
parseClass(Class, class, class, null, Class)
|
|
parsePrimaryConstructorOpt(DeclarationKind.Class, Class, null, allowExtensionTypeRepresentation: true)
|
|
listener: handleNoPrimaryConstructor(DeclarationKind.Class, Class, null)
|
|
parseClassHeaderOpt(Class, class, class)
|
|
parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
|
|
listener: handleNoType(Class)
|
|
listener: handleClassExtends(null, 1)
|
|
parseClassWithClauseOpt(Class)
|
|
listener: handleClassNoWithClause()
|
|
parseClassOrMixinOrEnumImplementsOpt(Class)
|
|
listener: handleImplements(null, 0)
|
|
listener: handleClassHeader(class, class, null)
|
|
parseClassOrMixinOrExtensionBody(Class, DeclarationKind.Class, Class)
|
|
listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
|
|
notEofOrType(CLOSE_CURLY_BRACKET, })
|
|
listener: endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
|
|
listener: endClassDeclaration(class, })
|
|
listener: endTopLevelDeclaration(})
|
|
parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations))
|
|
parseMetadataStar(})
|
|
listener: beginMetadataStar(macro)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelMemberImpl(})
|
|
listener: beginTopLevelMember(macro)
|
|
isReservedKeyword(class)
|
|
indicatesMethodOrField(Class)
|
|
parseFields(}, null, null, null, null, null, null, null, }, NoType(), macro, DeclarationKind.TopLevel, null, false)
|
|
listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
|
|
reportRecoverableError(macro, MissingConstFinalVarOrType)
|
|
listener: handleRecoverableError(MissingConstFinalVarOrType, macro, macro)
|
|
listener: handleNoType(})
|
|
ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
|
|
listener: handleIdentifier(macro, topLevelVariableDeclaration)
|
|
parseFieldInitializerOpt(macro, macro, null, null, null, null, null, DeclarationKind.TopLevel, null)
|
|
listener: handleNoFieldInitializer(class)
|
|
ensureSemicolon(macro)
|
|
reportRecoverableError(macro, Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}])
|
|
listener: handleRecoverableError(Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}], macro, macro)
|
|
rewriter()
|
|
listener: endTopLevelFields(null, null, null, null, null, null, null, 1, macro, ;)
|
|
listener: endTopLevelDeclaration(;)
|
|
parseTopLevelDeclarationImpl(;, DirectiveContext(DirectiveState.Declarations))
|
|
parseMetadataStar(;)
|
|
listener: beginMetadataStar(class)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelKeywordDeclaration(class, ;, class, null, null, null, DirectiveContext(DirectiveState.Declarations))
|
|
parseClassOrNamedMixinApplication(class, null, null, null, null, null, null, null, class)
|
|
listener: beginClassOrMixinOrNamedMixinApplicationPrelude(class)
|
|
ensureIdentifier(class, classOrMixinDeclaration)
|
|
listener: handleIdentifier(Class, classOrMixinDeclaration)
|
|
listener: handleNoTypeVariables(=)
|
|
listener: beginNamedMixinApplication(class, null, null, null, null, null, null, null, Class)
|
|
parseNamedMixinApplication(Class, class, class)
|
|
listener: handleIdentifier(Object, typeReference)
|
|
listener: handleNoTypeArguments(with)
|
|
listener: handleType(Object, null)
|
|
parseMixinApplicationRest(Object)
|
|
parseTypeList(with)
|
|
listener: beginTypeList(Mixin)
|
|
listener: handleIdentifier(Mixin, typeReference)
|
|
listener: handleNoTypeArguments(;)
|
|
listener: handleType(Mixin, null)
|
|
listener: endTypeList(1)
|
|
listener: handleNamedMixinApplicationWithClause(with)
|
|
ensureSemicolon(Mixin)
|
|
listener: endNamedMixinApplication(class, class, =, null, ;)
|
|
listener: endTopLevelDeclaration(;)
|
|
parseTopLevelDeclarationImpl(;, DirectiveContext(DirectiveState.Declarations))
|
|
parseMetadataStar(;)
|
|
listener: beginMetadataStar(abstract)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelMemberImpl(;)
|
|
listener: beginTopLevelMember(abstract)
|
|
isReservedKeyword(class)
|
|
indicatesMethodOrField(Class)
|
|
reportRecoverableErrorWithToken(abstract, Template(ExtraneousModifier))
|
|
listener: handleRecoverableError(Message[Template(ExtraneousModifier), Can't have modifier 'abstract' here., Try removing 'abstract'., {lexeme: abstract}], abstract, abstract)
|
|
parseFields(;, abstract, null, null, null, null, null, null, abstract, NoType(), macro, DeclarationKind.TopLevel, null, false)
|
|
listener: beginFields(DeclarationKind.TopLevel, null, abstract, null, null, null, null, null, ;)
|
|
reportRecoverableError(macro, MissingConstFinalVarOrType)
|
|
listener: handleRecoverableError(MissingConstFinalVarOrType, macro, macro)
|
|
listener: handleNoType(abstract)
|
|
ensureIdentifierPotentiallyRecovered(abstract, topLevelVariableDeclaration, false)
|
|
listener: handleIdentifier(macro, topLevelVariableDeclaration)
|
|
parseFieldInitializerOpt(macro, macro, null, abstract, null, null, null, DeclarationKind.TopLevel, null)
|
|
listener: handleNoFieldInitializer(class)
|
|
ensureSemicolon(macro)
|
|
reportRecoverableError(macro, Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}])
|
|
listener: handleRecoverableError(Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}], macro, macro)
|
|
rewriter()
|
|
listener: endTopLevelFields(null, abstract, null, null, null, null, null, 1, abstract, ;)
|
|
listener: endTopLevelDeclaration(;)
|
|
parseTopLevelDeclarationImpl(;, DirectiveContext(DirectiveState.Declarations))
|
|
parseMetadataStar(;)
|
|
listener: beginMetadataStar(class)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelKeywordDeclaration(class, ;, class, null, null, null, DirectiveContext(DirectiveState.Declarations))
|
|
parseClassOrNamedMixinApplication(class, null, null, null, null, null, null, null, class)
|
|
listener: beginClassOrMixinOrNamedMixinApplicationPrelude(class)
|
|
ensureIdentifier(class, classOrMixinDeclaration)
|
|
listener: handleIdentifier(Class, classOrMixinDeclaration)
|
|
listener: handleNoTypeVariables(=)
|
|
listener: beginNamedMixinApplication(class, null, null, null, null, null, null, null, Class)
|
|
parseNamedMixinApplication(Class, class, class)
|
|
listener: handleIdentifier(Object, typeReference)
|
|
listener: handleNoTypeArguments(with)
|
|
listener: handleType(Object, null)
|
|
parseMixinApplicationRest(Object)
|
|
parseTypeList(with)
|
|
listener: beginTypeList(Mixin)
|
|
listener: handleIdentifier(Mixin, typeReference)
|
|
listener: handleNoTypeArguments(;)
|
|
listener: handleType(Mixin, null)
|
|
listener: endTypeList(1)
|
|
listener: handleNamedMixinApplicationWithClause(with)
|
|
ensureSemicolon(Mixin)
|
|
listener: endNamedMixinApplication(class, class, =, null, ;)
|
|
listener: endTopLevelDeclaration(;)
|
|
reportAllErrorTokens(macro)
|
|
listener: endCompilationUnit(8, )
|