b5da327ed9
Make the parser handle metadata properly according to the spec. There has been some confusion in regards to metadata because https://github.com/dart-lang/language/blob/master/accepted/future-releases/small-features-21Q1/feature-specification.md (used to) say we needed a spec update. That was done in the parser in https://dart-review.googlesource.com/c/sdk/+/182668 but really that made the parser adhere to the spec as it was which is also correct (as the spec change wasn't needed at all). The parser also needs to be able to skip metadata, though, and that wasn't done it that CL which caused the issues in https://github.com/dart-lang/sdk/issues/45120 The work directly in this CL is: * Add lots of comments to parseMetadata to make them more up-to-date with the spec. * Fix skipMetadata to correspond to parseMetadata. * Tests verifying that 45120 is fixed in the parser and that metadata in general works as expected in the parser. (In working on this, the future specification was corrected to say that the spec did not need updating. Thanks to Erik for the quick turn-around there). Bug: #45120 Change-Id: Id1e4912cac7e5d9113efe083b3ecd06e6834a16e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190880 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
302 lines
16 KiB
Plaintext
302 lines
16 KiB
Plaintext
parseUnit(@)
|
|
skipErrorTokens(@)
|
|
listener: beginCompilationUnit(@)
|
|
syntheticPreviousToken(@)
|
|
parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
|
|
parseMetadataStar()
|
|
listener: beginMetadataStar(@)
|
|
parseMetadata()
|
|
listener: beginMetadata(@)
|
|
ensureIdentifier(@, metadataReference)
|
|
listener: handleIdentifier(A, metadataReference)
|
|
parseQualifiedRestOpt(A, metadataContinuation)
|
|
listener: beginTypeArguments(<)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(>)
|
|
listener: handleType(int, null)
|
|
listener: endTypeArguments(1, <, >)
|
|
parseArgumentsOpt(>)
|
|
parseArguments(>)
|
|
parseArgumentsRest(()
|
|
listener: beginArguments(()
|
|
parseExpression(()
|
|
parsePrecedenceExpression((, 1, true)
|
|
parseUnaryExpression((, true)
|
|
parsePrimary((, expression)
|
|
parseLiteralInt(()
|
|
listener: handleLiteralInt(0)
|
|
listener: endArguments(1, (, ))
|
|
listener: endMetadata(@, null, typedef)
|
|
listener: endMetadataStar(1)
|
|
parseTopLevelKeywordDeclaration(), typedef, Instance of 'DirectiveContext')
|
|
parseTopLevelKeywordModifiers(), typedef)
|
|
parseTypedef(typedef)
|
|
listener: beginUncategorizedTopLevelDeclaration(typedef)
|
|
listener: beginFunctionTypeAlias(typedef)
|
|
ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
|
|
listener: handleIdentifier(F, typedefDeclaration)
|
|
listener: beginTypeVariables(<)
|
|
parseMetadataStar(<)
|
|
listener: beginMetadataStar(@)
|
|
parseMetadata(<)
|
|
listener: beginMetadata(@)
|
|
ensureIdentifier(@, metadataReference)
|
|
listener: handleIdentifier(A, metadataReference)
|
|
parseQualifiedRestOpt(A, metadataContinuation)
|
|
listener: beginTypeArguments(<)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(>)
|
|
listener: handleType(int, null)
|
|
listener: endTypeArguments(1, <, >)
|
|
parseArgumentsOpt(>)
|
|
parseArguments(>)
|
|
parseArgumentsRest(()
|
|
listener: beginArguments(()
|
|
parseExpression(()
|
|
parsePrecedenceExpression((, 1, true)
|
|
parseUnaryExpression((, true)
|
|
parsePrimary((, expression)
|
|
parseLiteralInt(()
|
|
listener: handleLiteralInt(0)
|
|
listener: endArguments(1, (, ))
|
|
listener: endMetadata(@, null, T)
|
|
listener: endMetadataStar(1)
|
|
ensureIdentifier(), typeVariableDeclaration)
|
|
listener: handleIdentifier(T, typeVariableDeclaration)
|
|
listener: beginTypeVariable(T)
|
|
listener: handleTypeVariablesDefined(T, 1)
|
|
listener: handleNoType(T)
|
|
listener: endTypeVariable(>, 0, null, null)
|
|
listener: endTypeVariables(<, >)
|
|
listener: beginFunctionType(int)
|
|
listener: beginTypeVariables(<)
|
|
parseMetadataStar(<)
|
|
listener: beginMetadataStar(@)
|
|
parseMetadata(<)
|
|
listener: beginMetadata(@)
|
|
ensureIdentifier(@, metadataReference)
|
|
listener: handleIdentifier(A, metadataReference)
|
|
parseQualifiedRestOpt(A, metadataContinuation)
|
|
listener: beginTypeArguments(<)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(>)
|
|
listener: handleType(int, null)
|
|
listener: endTypeArguments(1, <, >)
|
|
parseArgumentsOpt(>)
|
|
parseArguments(>)
|
|
parseArgumentsRest(()
|
|
listener: beginArguments(()
|
|
parseExpression(()
|
|
parsePrecedenceExpression((, 1, true)
|
|
parseUnaryExpression((, true)
|
|
parsePrimary((, expression)
|
|
parseLiteralInt(()
|
|
listener: handleLiteralInt(0)
|
|
listener: endArguments(1, (, ))
|
|
listener: endMetadata(@, null, X)
|
|
listener: endMetadataStar(1)
|
|
ensureIdentifier(), typeVariableDeclaration)
|
|
listener: handleIdentifier(X, typeVariableDeclaration)
|
|
listener: beginTypeVariable(X)
|
|
listener: handleTypeVariablesDefined(X, 1)
|
|
listener: handleNoType(X)
|
|
listener: endTypeVariable(>, 0, null, null)
|
|
listener: endTypeVariables(<, >)
|
|
ensureIdentifier(=, typeReference)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(Function)
|
|
listener: handleType(int, null)
|
|
parseFormalParametersRequiredOpt(>, MemberKind.GeneralizedFunctionType)
|
|
parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
|
|
listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
|
|
parseFormalParameter((, FormalParameterKind.mandatory, MemberKind.GeneralizedFunctionType)
|
|
parseMetadataStar(()
|
|
listener: beginMetadataStar(@)
|
|
parseMetadata(()
|
|
listener: beginMetadata(@)
|
|
ensureIdentifier(@, metadataReference)
|
|
listener: handleIdentifier(A, metadataReference)
|
|
parseQualifiedRestOpt(A, metadataContinuation)
|
|
listener: beginTypeArguments(<)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(>)
|
|
listener: handleType(int, null)
|
|
listener: endTypeArguments(1, <, >)
|
|
parseArgumentsOpt(>)
|
|
parseArguments(>)
|
|
parseArgumentsRest(()
|
|
listener: beginArguments(()
|
|
parseExpression(()
|
|
parsePrecedenceExpression((, 1, true)
|
|
parseUnaryExpression((, true)
|
|
parsePrimary((, expression)
|
|
parseLiteralInt(()
|
|
listener: handleLiteralInt(0)
|
|
listener: endArguments(1, (, ))
|
|
listener: endMetadata(@, null, int)
|
|
listener: endMetadataStar(1)
|
|
listener: beginFormalParameter(int, MemberKind.GeneralizedFunctionType, null, null, null)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments())
|
|
listener: handleType(int, null)
|
|
listener: handleNoName())
|
|
listener: handleFormalParameterWithoutValue())
|
|
listener: endFormalParameter(null, null, ), null, null, FormalParameterKind.mandatory, MemberKind.GeneralizedFunctionType)
|
|
listener: endFormalParameters(1, (, ), MemberKind.GeneralizedFunctionType)
|
|
listener: endFunctionType(Function, null)
|
|
ensureSemicolon())
|
|
listener: endFunctionTypeAlias(typedef, =, ;)
|
|
listener: endTopLevelDeclaration(void)
|
|
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
|
|
parseMetadataStar(;)
|
|
listener: beginMetadataStar(void)
|
|
listener: endMetadataStar(0)
|
|
parseTopLevelMemberImpl(;)
|
|
listener: beginTopLevelMember(void)
|
|
parseTopLevelMethod(;, null, ;, Instance of 'VoidType', null, main, false)
|
|
listener: beginTopLevelMethod(;, null)
|
|
listener: handleVoidKeyword(void)
|
|
ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
|
|
listener: handleIdentifier(main, topLevelFunctionDeclaration)
|
|
parseMethodTypeVar(main)
|
|
listener: handleNoTypeVariables(()
|
|
parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
|
|
parseFormalParameters(main, 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(}, @)
|
|
parseStatement({)
|
|
parseStatementX({)
|
|
parseExpressionStatementOrDeclaration({, false)
|
|
parseMetadataStar({)
|
|
listener: beginMetadataStar(@)
|
|
parseMetadata({)
|
|
listener: beginMetadata(@)
|
|
ensureIdentifier(@, metadataReference)
|
|
listener: handleIdentifier(A, metadataReference)
|
|
parseQualifiedRestOpt(A, metadataContinuation)
|
|
listener: beginTypeArguments(<)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(>)
|
|
listener: handleType(int, null)
|
|
listener: endTypeArguments(1, <, >)
|
|
parseArgumentsOpt(>)
|
|
parseArguments(>)
|
|
parseArgumentsRest(()
|
|
listener: beginArguments(()
|
|
parseExpression(()
|
|
parsePrecedenceExpression((, 1, true)
|
|
parseUnaryExpression((, true)
|
|
parsePrimary((, expression)
|
|
parseLiteralInt(()
|
|
listener: handleLiteralInt(0)
|
|
listener: endArguments(1, (, ))
|
|
listener: endMetadata(@, null, void)
|
|
listener: endMetadataStar(1)
|
|
parseExpressionStatementOrDeclarationAfterModifiers(), {, null, null, null, false)
|
|
looksLikeLocalFunction(f)
|
|
listener: beginFunctionType(void)
|
|
listener: beginTypeVariables(<)
|
|
parseMetadataStar(<)
|
|
listener: beginMetadataStar(@)
|
|
parseMetadata(<)
|
|
listener: beginMetadata(@)
|
|
ensureIdentifier(@, metadataReference)
|
|
listener: handleIdentifier(A, metadataReference)
|
|
parseQualifiedRestOpt(A, metadataContinuation)
|
|
listener: beginTypeArguments(<)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(>)
|
|
listener: handleType(int, null)
|
|
listener: endTypeArguments(1, <, >)
|
|
parseArgumentsOpt(>)
|
|
parseArguments(>)
|
|
parseArgumentsRest(()
|
|
listener: beginArguments(()
|
|
parseExpression(()
|
|
parsePrecedenceExpression((, 1, true)
|
|
parseUnaryExpression((, true)
|
|
parsePrimary((, expression)
|
|
parseLiteralInt(()
|
|
listener: handleLiteralInt(0)
|
|
listener: endArguments(1, (, ))
|
|
listener: endMetadata(@, null, X)
|
|
listener: endMetadataStar(1)
|
|
ensureIdentifier(), typeVariableDeclaration)
|
|
listener: handleIdentifier(X, typeVariableDeclaration)
|
|
listener: beginTypeVariable(X)
|
|
listener: handleTypeVariablesDefined(X, 1)
|
|
listener: handleNoType(X)
|
|
listener: endTypeVariable(>, 0, null, null)
|
|
listener: endTypeVariables(<, >)
|
|
listener: handleVoidKeyword(void)
|
|
parseFormalParametersRequiredOpt(>, MemberKind.GeneralizedFunctionType)
|
|
parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
|
|
listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
|
|
parseFormalParameter((, FormalParameterKind.mandatory, MemberKind.GeneralizedFunctionType)
|
|
parseMetadataStar(()
|
|
listener: beginMetadataStar(@)
|
|
parseMetadata(()
|
|
listener: beginMetadata(@)
|
|
ensureIdentifier(@, metadataReference)
|
|
listener: handleIdentifier(A, metadataReference)
|
|
parseQualifiedRestOpt(A, metadataContinuation)
|
|
listener: beginTypeArguments(<)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(>)
|
|
listener: handleType(int, null)
|
|
listener: endTypeArguments(1, <, >)
|
|
parseArgumentsOpt(>)
|
|
parseArguments(>)
|
|
parseArgumentsRest(()
|
|
listener: beginArguments(()
|
|
parseExpression(()
|
|
parsePrecedenceExpression((, 1, true)
|
|
parseUnaryExpression((, true)
|
|
parsePrimary((, expression)
|
|
parseLiteralInt(()
|
|
listener: handleLiteralInt(0)
|
|
listener: endArguments(1, (, ))
|
|
listener: endMetadata(@, null, int)
|
|
listener: endMetadataStar(1)
|
|
listener: beginFormalParameter(int, MemberKind.GeneralizedFunctionType, null, null, null)
|
|
listener: handleIdentifier(int, typeReference)
|
|
listener: handleNoTypeArguments(y)
|
|
listener: handleType(int, null)
|
|
ensureIdentifier(int, formalParameterDeclaration)
|
|
listener: handleIdentifier(y, formalParameterDeclaration)
|
|
listener: handleFormalParameterWithoutValue())
|
|
listener: endFormalParameter(null, null, y, null, null, FormalParameterKind.mandatory, MemberKind.GeneralizedFunctionType)
|
|
listener: endFormalParameters(1, (, ), MemberKind.GeneralizedFunctionType)
|
|
listener: endFunctionType(Function, ?)
|
|
listener: beginVariablesDeclaration(f, null, null)
|
|
parseVariablesDeclarationRest(?, true)
|
|
parseOptionallyInitializedIdentifier(?)
|
|
ensureIdentifier(?, localVariableDeclaration)
|
|
listener: handleIdentifier(f, localVariableDeclaration)
|
|
listener: beginInitializedIdentifier(f)
|
|
parseVariableInitializerOpt(f)
|
|
listener: beginVariableInitializer(=)
|
|
parseExpression(=)
|
|
parsePrecedenceExpression(=, 1, true)
|
|
parseUnaryExpression(=, true)
|
|
parsePrimary(=, expression)
|
|
parseLiteralNull(=)
|
|
listener: handleLiteralNull(null)
|
|
listener: endVariableInitializer(=)
|
|
listener: endInitializedIdentifier(f)
|
|
ensureSemicolon(null)
|
|
listener: endVariablesDeclaration(1, ;)
|
|
notEofOrValue(}, })
|
|
listener: endBlockFunctionBody(1, {, })
|
|
listener: endTopLevelMethod(void, null, })
|
|
listener: endTopLevelDeclaration()
|
|
reportAllErrorTokens(@)
|
|
listener: endCompilationUnit(2, )
|