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>
30 lines
1.7 KiB
Plaintext
30 lines
1.7 KiB
Plaintext
parseUnit(extension)
|
|
skipErrorTokens(extension)
|
|
listener: beginCompilationUnit(extension)
|
|
syntheticPreviousToken(extension)
|
|
parseTopLevelDeclarationImpl(, DirectiveContext(DirectiveState.Unknown))
|
|
parseMetadataStar()
|
|
listener: beginMetadataStar(extension)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelKeywordDeclaration(extension, , extension, null, null, null, DirectiveContext(DirectiveState.Unknown))
|
|
parseExtension(extension, null, extension)
|
|
listener: beginExtensionDeclarationPrelude(extension)
|
|
parseExtensionDeclaration(extension, extension, null, extension)
|
|
listener: handleNoTypeVariables(on)
|
|
listener: beginExtensionDeclaration(null, extension, Extension)
|
|
parsePrimaryConstructorOpt(DeclarationKind.Extension, Extension, const, allowExtensionTypeRepresentation: true)
|
|
reportRecoverableError(const, ExtensionPrimaryConstructor)
|
|
listener: handleRecoverableError(ExtensionPrimaryConstructor, const, const)
|
|
listener: handleNoPrimaryConstructor(DeclarationKind.Extension, Extension, const)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments({)
|
|
listener: handleType(int, null)
|
|
parseClassOrMixinOrExtensionBody(int, DeclarationKind.Extension, Extension)
|
|
listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
|
|
notEofOrType(CLOSE_CURLY_BRACKET, })
|
|
listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
|
|
listener: endExtensionDeclaration(extension, extension, on, })
|
|
listener: endTopLevelDeclaration(})
|
|
reportAllErrorTokens(extension)
|
|
listener: endCompilationUnit(1, )
|