dart-sdk/pkg/front_end/parser_testcases/extension_type.dart.expect
Johnni Winther 1683fd5c16 [_fe_analyzer_shared] Ensure beginToken on class, enum, mixin, extension and extension type
This passes the first token of these top level declaration directly
to the endX listener method.

In the CFE this is used to ensure that can handle the new modifiers in
the textual outline. Furthermore, support for extension types is added
and having an "unknown chunk" now results in an error. The latter should
help us keep the textual outline up-to-date wrt new features.

Change-Id: I813d6162b6cba0a2bf550ed33a6091abf9bf49f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324702
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-09-15 13:01:10 +00:00

53 lines
2.1 KiB
Plaintext

Problems reported:
parser/extension_type:3:16: An extension type declaration must have a primary constructor declaration.
extension type E on A {}
^
parser/extension_type:3:18: Expected 'extends' instead of this.
extension type E on A {}
^^
parser/extension_type:3:18: An extension type declaration can't have an 'extends' clause.
extension type E on A {}
^^
beginCompilationUnit(class)
beginMetadataStar(class)
endMetadataStar(0)
beginClassOrMixinOrNamedMixinApplicationPrelude(class)
handleIdentifier(A, classOrMixinDeclaration)
handleNoTypeVariables({)
beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
handleNoType(A)
handleClassExtends(null, 1)
handleClassNoWithClause()
handleImplements(null, 0)
handleClassHeader(class, class, null)
beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
endClassDeclaration(class, })
endTopLevelDeclaration(extension)
beginMetadataStar(extension)
endMetadataStar(0)
beginExtensionDeclarationPrelude(extension)
handleNoTypeVariables(on)
beginExtensionTypeDeclaration(extension, E)
handleRecoverableError(MissingPrimaryConstructor, E, E)
handleNoPrimaryConstructor(E, null)
handleImplements(null, 0)
handleRecoverableError(Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}], on, on)
handleIdentifier(A, typeReference)
handleNoTypeArguments({)
handleType(A, null)
handleClassExtends(on, 1)
handleRecoverableError(ExtensionTypeExtends, on, on)
handleClassNoWithClause()
handleImplements(null, 0)
handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
endExtensionTypeDeclaration(extension, extension, type, })
endTopLevelDeclaration()
endCompilationUnit(2, )