Files
sdk/pkg/front_end/parser_testcases/patterns/patternVariableDeclaration_inClass.dart.intertwined.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

82 lines
4.9 KiB
Plaintext

parseUnit(class)
skipErrorTokens(class)
listener: beginCompilationUnit(class)
syntheticPreviousToken(class)
parseTopLevelDeclarationImpl(, DirectiveContext(DirectiveState.Unknown))
parseMetadataStar()
listener: beginMetadataStar(class)
listener: endMetadataStar(0)
parseTopLevelKeywordDeclaration(class, , class, null, null, null, null, DirectiveContext(DirectiveState.Unknown))
parseClassOrNamedMixinApplication(class, null, null, null, null, null, null, null, null, class)
listener: beginClassOrMixinOrNamedMixinApplicationPrelude(class)
ensureIdentifier(class, classOrMixinDeclaration)
listener: handleIdentifier(C, classOrMixinDeclaration)
listener: handleNoTypeVariables({)
listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
parseClass(C, class, class, C)
parseClassHeaderOpt(C, class, class)
parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
listener: handleNoType(C)
listener: handleClassExtends(null, 1)
parseClassWithClauseOpt(C)
listener: handleClassNoWithClause()
parseClassOrMixinOrEnumImplementsOpt(C)
listener: handleImplements(null, 0)
listener: handleClassHeader(class, class, null)
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Class, C)
listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
notEofOrValue(}, var)
parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Class, C)
parseMetadataStar({)
listener: beginMetadataStar(var)
listener: endMetadataStar(0)
listener: beginMember()
skipOuterPattern(var)
reportRecoverableErrorWithEnd((, ), PatternVariableDeclarationOutsideFunctionOrMethod)
listener: handleRecoverableError(PatternVariableDeclarationOutsideFunctionOrMethod, (, ))
rewriter()
rewriter()
parseFields({, null, null, null, null, null, null, var, var, NoType(), , DeclarationKind.Class, C, true)
listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, var, {)
listener: handleNoType(var)
ensureIdentifierPotentiallyRecovered(var, fieldDeclaration, true)
listener: handleIdentifier(, fieldDeclaration)
parseFieldInitializerOpt(, , null, null, null, null, var, DeclarationKind.Class, C)
listener: beginFieldInitializer(=)
parseExpression(=)
looksLikeOuterPatternEquals(=)
skipOuterPattern(=)
parsePrecedenceExpression(=, 1, true, ConstantPatternContext.none)
parseUnaryExpression(=, true, ConstantPatternContext.none)
parsePrimary(=, expression, ConstantPatternContext.none)
parseParenthesizedExpressionFunctionLiteralOrRecordLiteral(=, ConstantPatternContext.none)
parseParenthesizedExpressionOrRecordLiteral(=, null, ConstantPatternContext.none)
listener: beginParenthesizedExpressionOrRecordLiteral(()
parseExpression(()
looksLikeOuterPatternEquals(()
skipOuterPattern(()
parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
parseUnaryExpression((, true, ConstantPatternContext.none)
parsePrimary((, expression, ConstantPatternContext.none)
parseLiteralInt(()
listener: handleLiteralInt(0)
parseExpression(,)
looksLikeOuterPatternEquals(,)
skipOuterPattern(,)
parsePrecedenceExpression(,, 1, true, ConstantPatternContext.none)
parseUnaryExpression(,, true, ConstantPatternContext.none)
parsePrimary(,, expression, ConstantPatternContext.none)
parseLiteralInt(,)
listener: handleLiteralInt(1)
ensureCloseParen(1, ()
listener: endRecordLiteral((, 2, null)
listener: endFieldInitializer(=, ))
listener: endClassFields(null, null, null, null, null, null, var, 1, var, ;)
listener: endMember()
notEofOrValue(}, })
listener: endClassOrMixinOrExtensionBody(DeclarationKind.Class, 1, {, })
listener: endClassDeclaration(class, })
listener: endTopLevelDeclaration(})
reportAllErrorTokens(class)
listener: endCompilationUnit(1, )