Files
sdk/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.intertwined.expect
T
Jens Johansen 3a1f732c0f [parser] Make begin/end events always come in pairs
This CL:
* Changes the events so beginX and endX events always comes in pairs
  (though technically not right as some specific events can be beginX
  endY --- but in those cases it is at least documented and used in code
  that actually tests it).
  -> This entails adding some events and converting something from
    "beginX" to "handleX" instead.
* Adds a utility that can generate an AST of sorts directly from the
  parser via a listener using the begin/end matching (and knowing of the
  specific ones that doesn't match directly).
* Adds a test that checks that - at least for all tested (50,000+) files
  - the AST actually generate "correctly", i.e. matches up begin/ends
  and ends up with a single top entry "CompilationUnit".
* Adds a different visualization to the parser listener events by
  displaying the "AST directly from the parser" in a UI that can be
  navigated. The visualization may not be the best, but it's certainly
  a stepping stone.

Change-Id: I9b27f7bbf3be442adc92f357c7b3c46da6f84cf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159664
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-01 09:30:43 +00:00

580 lines
36 KiB
Plaintext

parseUnit(f)
skipErrorTokens(f)
listener: beginCompilationUnit(f)
syntheticPreviousToken(f)
parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
parseMetadataStar()
listener: beginMetadataStar(f)
listener: endMetadataStar(0)
parseTopLevelMemberImpl()
listener: beginTopLevelMember(f)
isReservedKeyword(()
parseTopLevelMethod(, null, , Instance of 'NoType', null, f, false)
listener: beginTopLevelMethod(, null)
listener: handleNoType()
ensureIdentifierPotentiallyRecovered(, topLevelFunctionDeclaration, false)
listener: handleIdentifier(f, topLevelFunctionDeclaration)
parseMethodTypeVar(f)
listener: handleNoTypeVariables(()
parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
parseFormalParameters(f, MemberKind.TopLevelMethod)
parseFormalParametersRest((, MemberKind.TopLevelMethod)
listener: beginFormalParameters((, MemberKind.TopLevelMethod)
listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
parseAsyncModifierOpt())
listener: handleAsyncModifier(null, null)
inPlainSync()
parseFunctionBody(), false, false)
listener: beginBlockFunctionBody({)
notEofOrValue(}, var)
parseStatement({)
parseStatementX({)
parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
looksLikeLocalFunction(a)
listener: beginMetadataStar(var)
listener: endMetadataStar(0)
listener: handleNoType(var)
listener: beginVariablesDeclaration(a, null, var)
parseVariablesDeclarationRest(var, true)
parseOptionallyInitializedIdentifier(var)
ensureIdentifier(var, localVariableDeclaration)
listener: handleIdentifier(a, localVariableDeclaration)
listener: beginInitializedIdentifier(a)
parseVariableInitializerOpt(a)
listener: handleNoVariableInitializer(a)
listener: endInitializedIdentifier(a)
parseOptionallyInitializedIdentifier(,)
ensureIdentifier(,, localVariableDeclaration)
listener: handleIdentifier(b, localVariableDeclaration)
listener: beginInitializedIdentifier(b)
parseVariableInitializerOpt(b)
listener: handleNoVariableInitializer(b)
listener: endInitializedIdentifier(b)
parseOptionallyInitializedIdentifier(,)
ensureIdentifier(,, localVariableDeclaration)
listener: handleIdentifier(c, localVariableDeclaration)
listener: beginInitializedIdentifier(c)
parseVariableInitializerOpt(c)
listener: handleNoVariableInitializer(c)
listener: endInitializedIdentifier(c)
ensureSemicolon(c)
listener: endVariablesDeclaration(3, ;)
notEofOrValue(}, a)
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(a)
parseExpressionStatement(;)
parseExpression(;)
parsePrecedenceExpression(;, 1, true)
parseUnaryExpression(;, true)
parsePrimary(;, expression)
parseSendOrFunctionLiteral(;, expression)
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(a, expression)
listener: handleNoTypeArguments(?)
parseArgumentsOpt(a)
listener: handleNoArguments(?)
listener: handleSend(a, ?)
canParseAsConditional(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
parseLiteralListSuffix(?, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
parseArgumentsOpt(b)
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseSendOrFunctionLiteral(:, expression)
parseSend(:, expression)
ensureIdentifier(:, expression)
parseArgumentsOpt(c)
parseConditionalExpressionRest(a)
listener: beginConditionalExpression(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
listener: handleNoTypeArguments([)
parseLiteralListSuffix(?, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(b, expression)
listener: handleNoTypeArguments(])
parseArgumentsOpt(b)
listener: handleNoArguments(])
listener: handleSend(b, ])
listener: handleLiteralList(1, [, null, ])
ensureColon(])
listener: handleConditionalExpressionColon()
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseSendOrFunctionLiteral(:, expression)
parseSend(:, expression)
ensureIdentifier(:, expression)
listener: handleIdentifier(c, expression)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(c)
listener: handleNoArguments(;)
listener: handleSend(c, ;)
listener: endConditionalExpression(?, :)
ensureSemicolon(c)
listener: handleExpressionStatement(;)
notEofOrValue(}, a)
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(a)
parseExpressionStatement(;)
parseExpression(;)
parsePrecedenceExpression(;, 1, true)
parseUnaryExpression(;, true)
parsePrimary(;, expression)
parseSendOrFunctionLiteral(;, expression)
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(a, expression)
listener: handleNoTypeArguments(?)
parseArgumentsOpt(a)
listener: handleNoArguments(?)
listener: handleSend(a, ?)
canParseAsConditional(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
parseLiteralListSuffix(?, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
parseArgumentsOpt(b)
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseSendOrFunctionLiteral(:, expression)
parseSend(:, expression)
ensureIdentifier(:, expression)
parseArgumentsOpt(c)
parseConditionalExpressionRest(a)
listener: beginConditionalExpression(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
listener: handleNoTypeArguments([)
parseLiteralListSuffix(?, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(b, expression)
listener: handleNoTypeArguments(])
parseArgumentsOpt(b)
listener: handleNoArguments(])
listener: handleSend(b, ])
listener: handleLiteralList(1, [, null, ])
ensureColon(])
listener: handleConditionalExpressionColon()
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseSendOrFunctionLiteral(:, expression)
parseSend(:, expression)
ensureIdentifier(:, expression)
listener: handleIdentifier(c, expression)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(c)
listener: handleNoArguments(;)
listener: handleSend(c, ;)
listener: endConditionalExpression(?, :)
ensureSemicolon(c)
listener: handleExpressionStatement(;)
notEofOrValue(}, a)
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(a)
parseExpressionStatement(;)
parseExpression(;)
parsePrecedenceExpression(;, 1, true)
parseUnaryExpression(;, true)
parsePrimary(;, expression)
parseSendOrFunctionLiteral(;, expression)
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(a, expression)
listener: handleNoTypeArguments(?)
parseArgumentsOpt(a)
listener: handleNoArguments(?)
listener: handleSend(a, ?)
canParseAsConditional(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
parseLiteralListSuffix(?, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
parseArgumentsOpt(b)
parsePrimary(., expressionContinuation)
parseSendOrFunctionLiteral(., expressionContinuation)
looksLikeFunctionBody(:)
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
parseArgumentsOpt(toString)
parseArguments(toString)
parseArgumentsRest(()
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseSendOrFunctionLiteral(:, expression)
parseSend(:, expression)
ensureIdentifier(:, expression)
parseArgumentsOpt(c)
parseConditionalExpressionRest(a)
listener: beginConditionalExpression(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
listener: handleNoTypeArguments([)
parseLiteralListSuffix(?, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(b, expression)
listener: handleNoTypeArguments(])
parseArgumentsOpt(b)
listener: handleNoArguments(])
listener: handleSend(b, ])
listener: handleLiteralList(1, [, null, ])
parsePrimary(., expressionContinuation)
parseSendOrFunctionLiteral(., expressionContinuation)
looksLikeFunctionBody(:)
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(toString, expressionContinuation)
listener: handleNoTypeArguments(()
parseArgumentsOpt(toString)
parseArguments(toString)
parseArgumentsRest(()
listener: beginArguments(()
listener: endArguments(0, (, ))
listener: handleSend(toString, :)
listener: handleEndingBinaryExpression(.)
ensureColon())
listener: handleConditionalExpressionColon()
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseSendOrFunctionLiteral(:, expression)
parseSend(:, expression)
ensureIdentifier(:, expression)
listener: handleIdentifier(c, expression)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(c)
listener: handleNoArguments(;)
listener: handleSend(c, ;)
listener: endConditionalExpression(?, :)
ensureSemicolon(c)
listener: handleExpressionStatement(;)
notEofOrValue(}, a)
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(a)
parseExpressionStatement(;)
parseExpression(;)
parsePrecedenceExpression(;, 1, true)
parseUnaryExpression(;, true)
parsePrimary(;, expression)
parseSendOrFunctionLiteral(;, expression)
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(a, expression)
listener: handleNoTypeArguments(?)
parseArgumentsOpt(a)
listener: handleNoArguments(?)
listener: handleSend(a, ?)
canParseAsConditional(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
parseLiteralListSuffix(?, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
parseArgumentsOpt(b)
parsePrimary(., expressionContinuation)
parseSendOrFunctionLiteral(., expressionContinuation)
looksLikeFunctionBody(:)
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
parseArgumentsOpt(toString)
parseArguments(toString)
parseArgumentsRest(()
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseSendOrFunctionLiteral(:, expression)
parseSend(:, expression)
ensureIdentifier(:, expression)
parseArgumentsOpt(c)
parseConditionalExpressionRest(a)
listener: beginConditionalExpression(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
listener: handleNoTypeArguments([)
parseLiteralListSuffix(?, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(b, expression)
listener: handleNoTypeArguments(])
parseArgumentsOpt(b)
listener: handleNoArguments(])
listener: handleSend(b, ])
listener: handleLiteralList(1, [, null, ])
parsePrimary(., expressionContinuation)
parseSendOrFunctionLiteral(., expressionContinuation)
looksLikeFunctionBody(:)
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(toString, expressionContinuation)
listener: handleNoTypeArguments(()
parseArgumentsOpt(toString)
parseArguments(toString)
parseArgumentsRest(()
listener: beginArguments(()
listener: endArguments(0, (, ))
listener: handleSend(toString, :)
listener: handleEndingBinaryExpression(.)
ensureColon())
listener: handleConditionalExpressionColon()
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseSendOrFunctionLiteral(:, expression)
parseSend(:, expression)
ensureIdentifier(:, expression)
listener: handleIdentifier(c, expression)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(c)
listener: handleNoArguments(;)
listener: handleSend(c, ;)
listener: endConditionalExpression(?, :)
ensureSemicolon(c)
listener: handleExpressionStatement(;)
notEofOrValue(}, a)
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(a)
parseExpressionStatement(;)
parseExpression(;)
parsePrecedenceExpression(;, 1, true)
parseUnaryExpression(;, true)
parsePrimary(;, expression)
parseSendOrFunctionLiteral(;, expression)
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(a, expression)
listener: handleNoTypeArguments(?)
parseArgumentsOpt(a)
listener: handleNoArguments(?)
listener: handleSend(a, ?)
parseConditionalExpressionRest(a)
listener: beginConditionalExpression(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
parseLiteralListSetMapOrFunction(?, null)
listener: beginTypeArguments(<)
listener: handleIdentifier(dynamic, typeReference)
listener: handleNoTypeArguments(>)
listener: handleType(dynamic, null)
listener: endTypeArguments(1, <, >)
parseLiteralListSuffix(>, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(b, expression)
listener: handleNoTypeArguments(])
parseArgumentsOpt(b)
listener: handleNoArguments(])
listener: handleSend(b, ])
listener: handleLiteralList(1, [, null, ])
ensureColon(])
listener: handleConditionalExpressionColon()
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseLiteralListSetMapOrFunction(:, null)
listener: beginTypeArguments(<)
listener: handleIdentifier(dynamic, typeReference)
listener: handleNoTypeArguments(>)
listener: handleType(dynamic, null)
listener: endTypeArguments(1, <, >)
parseLiteralListSuffix(>, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(c, expression)
listener: handleNoTypeArguments(])
parseArgumentsOpt(c)
listener: handleNoArguments(])
listener: handleSend(c, ])
listener: handleLiteralList(1, [, null, ])
listener: endConditionalExpression(?, :)
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, a)
parseStatement(;)
parseStatementX(;)
parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
looksLikeLocalFunction(a)
parseExpressionStatement(;)
parseExpression(;)
parsePrecedenceExpression(;, 1, true)
parseUnaryExpression(;, true)
parsePrimary(;, expression)
parseSendOrFunctionLiteral(;, expression)
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(a, expression)
listener: handleNoTypeArguments(?)
parseArgumentsOpt(a)
listener: handleNoArguments(?)
listener: handleSend(a, ?)
parseConditionalExpressionRest(a)
listener: beginConditionalExpression(?)
parseExpressionWithoutCascade(?)
parsePrecedenceExpression(?, 1, false)
parseUnaryExpression(?, false)
parsePrimary(?, expression)
parseParenthesizedExpressionOrFunctionLiteral(?)
parseParenthesizedExpression(?)
parseExpressionInParenthesis(?)
parseExpressionInParenthesisRest(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
listener: handleNoTypeArguments([)
parseLiteralListSuffix((, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(b, expression)
listener: handleNoTypeArguments(])
parseArgumentsOpt(b)
listener: handleNoArguments(])
listener: handleSend(b, ])
listener: handleLiteralList(1, [, null, ])
ensureCloseParen(], ()
listener: handleParenthesizedExpression(()
ensureColon())
listener: handleConditionalExpressionColon()
parseExpressionWithoutCascade(:)
parsePrecedenceExpression(:, 1, false)
parseUnaryExpression(:, false)
parsePrimary(:, expression)
parseParenthesizedExpressionOrFunctionLiteral(:)
parseParenthesizedExpression(:)
parseExpressionInParenthesis(:)
parseExpressionInParenthesisRest(()
parseExpression(()
parsePrecedenceExpression((, 1, true)
parseUnaryExpression((, true)
parsePrimary((, expression)
listener: handleNoTypeArguments([)
parseLiteralListSuffix((, null)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
parsePrimary([, expression)
parseSendOrFunctionLiteral([, expression)
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(c, expression)
listener: handleNoTypeArguments(])
parseArgumentsOpt(c)
listener: handleNoArguments(])
listener: handleSend(c, ])
listener: handleLiteralList(1, [, null, ])
ensureCloseParen(], ()
listener: handleParenthesizedExpression(()
listener: endConditionalExpression(?, :)
ensureSemicolon())
listener: handleExpressionStatement(;)
notEofOrValue(}, })
listener: endBlockFunctionBody(7, {, })
listener: endTopLevelMethod(f, null, })
listener: endTopLevelDeclaration()
reportAllErrorTokens(f)
listener: endCompilationUnit(1, )