Files
sdk/pkg/front_end/parser_testcases/extensions/const.dart.expect
T
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

72 lines
3.0 KiB
Plaintext

Problems reported:
parser/extensions/const:1:1: Expected 'on' after this.
extension const Extension on int {}
^^^^^^^^^
parser/extensions/const:1:11: Expected a type, but got 'const'.
extension const Extension on int {}
^^^^^
parser/extensions/const:1:11: An extension declaration must have a body, even if it is empty.
extension const Extension on int {}
^^^^^
parser/extensions/const:1:27: The const variable 'on' must be initialized.
extension const Extension on int {}
^^
parser/extensions/const:1:27: Expected ';' after this.
extension const Extension on int {}
^^
parser/extensions/const:1:30: A function declaration needs an explicit list of parameters.
extension const Extension on int {}
^^^
beginCompilationUnit(extension)
beginMetadataStar(extension)
endMetadataStar(0)
beginExtensionDeclarationPrelude(extension)
handleNoTypeVariables(const)
beginExtensionDeclaration(extension, null)
handleRecoverableError(Message[ExpectedAfterButGot, Expected 'on' after this., null, {string: on}], extension, extension)
handleRecoverableError(Message[ExpectedType, Expected a type, but got 'const'., null, {lexeme: const}], const, const)
handleIdentifier(, typeReference)
handleNoTypeArguments(const)
handleType(, null)
handleRecoverableError(ExpectedExtensionBody, const, const)
beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
endExtensionDeclaration(extension, extension, on, })
endTopLevelDeclaration(const)
beginMetadataStar(const)
endMetadataStar(0)
beginTopLevelMember(const)
beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, const, })
handleIdentifier(Extension, typeReference)
handleNoTypeArguments(on)
handleType(Extension, null)
handleIdentifier(on, topLevelVariableDeclaration)
handleRecoverableError(Message[ConstFieldWithoutInitializer, The const variable 'on' must be initialized., Try adding an initializer ('= expression') to the declaration., {name: on}], on, on)
handleNoFieldInitializer(int)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], on, on)
endTopLevelFields(null, null, null, null, const, 1, const, ;)
endTopLevelDeclaration(int)
beginMetadataStar(int)
endMetadataStar(0)
beginTopLevelMember(int)
beginTopLevelMethod(;, null, null)
handleNoType(;)
handleIdentifier(int, topLevelFunctionDeclaration)
handleNoTypeVariables({)
handleRecoverableError(MissingFunctionParameters, int, int)
beginFormalParameters((, MemberKind.TopLevelMethod)
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginBlockFunctionBody({)
endBlockFunctionBody(0, {, })
endTopLevelMethod(int, null, })
endTopLevelDeclaration()
endCompilationUnit(3, )