Files
sdk/pkg/front_end/parser_testcases/macros/augment_class.dart.expect
T
Jens Johansen fc67d31862 [parser] Listener calls should not be on the next (unrelated) token
When the parser sends events to the listener some events has a pair of
parameters, `beginToken` and `endToken`. Most of these are constructed
in such a way that the `beginToken` is the first token and the
`endToken` is the last token in that construct. This is for instance the
case with `endClassDeclaration`.
It was, however, not the case for `endMetadata` where `endToken` instead
was the next token *not* in the metadata.

In this CL I've found a changed the following to point to the last token
in the construct instead of the next token not in the construct and
renamed the parameter where it made sense:

* `endAssert` --- and renamed `semicolonToken` (which only pointed to
  a semicolon for statements) to `endToken`.
* `endAwaitExpression`
* `endConstLiteral` --- and renamed `token` to `endToken`
* `endConstructorReference`
* `endFieldInitializer` --- and renamed `token` to `endToken`
* `endForIn`
* `endForInBody` --- and renamed `token` to `endToken`
* `endForStatement`
* `endForStatementBody` --- and renamed `token` to `endToken`
* `endFunctionExpression` --- and renamed `token` to `endToken`
* `endInitializer` --- and renamed `token` to `endToken`
* `endInitializers`
* `endInvalidAwaitExpression`
* `endMetadata`
* `endSwitchCase`
* `endTopLevelDeclaration` --- and renamed `nextToken` to `endToken`
* `endWhileStatement`
* `endWhileStatementBody` --- and renamed `token` to `endToken`
* `handleNoConstructorReferenceContinuationAfterTypeArguments`

In the few places in listeners where these values were used I've mostly
updated to do e.g. `endToken.text!` to retain the current behavior.

Change-Id: I25495e160d1eec5c75bcf1313b512cd04bcb1533
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364322
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-04-26 06:59:23 +00:00

155 lines
6.6 KiB
Plaintext

Problems reported:
parser/macros/augment_class:1:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
augment class Class {}
^^^^^^^
parser/macros/augment_class:1:1: Expected ';' after this.
augment class Class {}
^^^^^^^
parser/macros/augment_class:2:1: Can't have modifier 'abstract' here.
abstract augment class Class {}
^^^^^^^^
parser/macros/augment_class:2:10: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
abstract augment class Class {}
^^^^^^^
parser/macros/augment_class:2:10: Expected ';' after this.
abstract augment class Class {}
^^^^^^^
parser/macros/augment_class:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
augment class Class = Object with Mixin;
^^^^^^^
parser/macros/augment_class:3:1: Expected ';' after this.
augment class Class = Object with Mixin;
^^^^^^^
parser/macros/augment_class:4:1: Can't have modifier 'abstract' here.
abstract augment class Class = Object with Mixin;
^^^^^^^^
parser/macros/augment_class:4:10: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
abstract augment class Class = Object with Mixin;
^^^^^^^
parser/macros/augment_class:4:10: Expected ';' after this.
abstract augment class Class = Object with Mixin;
^^^^^^^
beginCompilationUnit(augment)
beginMetadataStar(augment)
endMetadataStar(0)
beginTopLevelMember(augment)
beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, )
handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
handleNoType()
handleIdentifier(augment, topLevelVariableDeclaration)
handleNoFieldInitializer(class)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
endTopLevelFields(null, null, null, null, null, null, 1, augment, ;)
endTopLevelDeclaration(;)
beginMetadataStar(class)
endMetadataStar(0)
beginClassOrMixinOrNamedMixinApplicationPrelude(class)
handleIdentifier(Class, classOrMixinDeclaration)
handleNoTypeVariables({)
beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
handleNoType(Class)
handleClassExtends(null, 1)
handleClassNoWithClause()
handleImplements(null, 0)
handleClassHeader(class, class, null)
beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
endClassDeclaration(class, })
endTopLevelDeclaration(})
beginMetadataStar(abstract)
endMetadataStar(0)
beginTopLevelMember(abstract)
handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'abstract' here., Try removing 'abstract'., {lexeme: abstract}], abstract, abstract)
beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
handleNoType(abstract)
handleIdentifier(augment, topLevelVariableDeclaration)
handleNoFieldInitializer(class)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
endTopLevelFields(null, null, null, null, null, null, 1, abstract, ;)
endTopLevelDeclaration(;)
beginMetadataStar(class)
endMetadataStar(0)
beginClassOrMixinOrNamedMixinApplicationPrelude(class)
handleIdentifier(Class, classOrMixinDeclaration)
handleNoTypeVariables({)
beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
handleNoType(Class)
handleClassExtends(null, 1)
handleClassNoWithClause()
handleImplements(null, 0)
handleClassHeader(class, class, null)
beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
endClassDeclaration(class, })
endTopLevelDeclaration(})
beginMetadataStar(augment)
endMetadataStar(0)
beginTopLevelMember(augment)
beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
handleNoType(})
handleIdentifier(augment, topLevelVariableDeclaration)
handleNoFieldInitializer(class)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
endTopLevelFields(null, null, null, null, null, null, 1, augment, ;)
endTopLevelDeclaration(;)
beginMetadataStar(class)
endMetadataStar(0)
beginClassOrMixinOrNamedMixinApplicationPrelude(class)
handleIdentifier(Class, classOrMixinDeclaration)
handleNoTypeVariables(=)
beginNamedMixinApplication(class, null, null, null, null, null, null, null, null, Class)
handleIdentifier(Object, typeReference)
handleNoTypeArguments(with)
handleType(Object, null)
beginTypeList(Mixin)
handleIdentifier(Mixin, typeReference)
handleNoTypeArguments(;)
handleType(Mixin, null)
endTypeList(1)
handleNamedMixinApplicationWithClause(with)
endNamedMixinApplication(class, class, =, null, ;)
endTopLevelDeclaration(;)
beginMetadataStar(abstract)
endMetadataStar(0)
beginTopLevelMember(abstract)
handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'abstract' here., Try removing 'abstract'., {lexeme: abstract}], abstract, abstract)
beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
handleRecoverableError(MissingConstFinalVarOrType, augment, augment)
handleNoType(abstract)
handleIdentifier(augment, topLevelVariableDeclaration)
handleNoFieldInitializer(class)
handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], augment, augment)
endTopLevelFields(null, null, null, null, null, null, 1, abstract, ;)
endTopLevelDeclaration(;)
beginMetadataStar(class)
endMetadataStar(0)
beginClassOrMixinOrNamedMixinApplicationPrelude(class)
handleIdentifier(Class, classOrMixinDeclaration)
handleNoTypeVariables(=)
beginNamedMixinApplication(class, null, null, null, null, null, null, null, null, Class)
handleIdentifier(Object, typeReference)
handleNoTypeArguments(with)
handleType(Object, null)
beginTypeList(Mixin)
handleIdentifier(Mixin, typeReference)
handleNoTypeArguments(;)
handleType(Mixin, null)
endTypeList(1)
handleNamedMixinApplicationWithClause(with)
endNamedMixinApplication(class, class, =, null, ;)
endTopLevelDeclaration(;)
endCompilationUnit(8, )