3a1f732c0f
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>
305 lines
13 KiB
Plaintext
305 lines
13 KiB
Plaintext
Problems reported:
|
|
|
|
parser/general/issue_41121:10:12: The name of a constructor must match the name of the enclosing class.
|
|
void set configuration(Configuration configuration)
|
|
^^^^^^^^^^^^^
|
|
|
|
parser/general/issue_41121:10:8: Constructors can't be a setter.
|
|
void set configuration(Configuration configuration)
|
|
^^^
|
|
|
|
parser/general/issue_41121:10:3: Constructors can't have a return type.
|
|
void set configuration(Configuration configuration)
|
|
^^^^
|
|
|
|
parser/general/issue_41121:16:21: A method declaration needs an explicit list of parameters.
|
|
Configuration get configuration
|
|
^^^^^^^^^^^^^
|
|
|
|
parser/general/issue_41121:16:21: The name of a constructor must match the name of the enclosing class.
|
|
Configuration get configuration
|
|
^^^^^^^^^^^^^
|
|
|
|
parser/general/issue_41121:16:17: Constructors can't be a getter.
|
|
Configuration get configuration
|
|
^^^
|
|
|
|
parser/general/issue_41121:16:3: Constructors can't have a return type.
|
|
Configuration get configuration
|
|
^^^^^^^^^^^^^
|
|
|
|
parser/general/issue_41121:23:8: The name of a constructor must match the name of the enclosing class.
|
|
void method() : _configuration = null {
|
|
^^^^^^
|
|
|
|
parser/general/issue_41121:23:3: Constructors can't have a return type.
|
|
void method() : _configuration = null {
|
|
^^^^
|
|
|
|
parser/general/issue_41121:27:3: The name of a constructor must match the name of the enclosing class.
|
|
Foo() : _configuration = null {
|
|
^^^
|
|
|
|
beginCompilationUnit(class)
|
|
beginMetadataStar(class)
|
|
endMetadataStar(0)
|
|
beginClassOrNamedMixinApplicationPrelude(class)
|
|
handleIdentifier(ConfigurationService, classOrMixinDeclaration)
|
|
handleNoTypeVariables({)
|
|
beginClassDeclaration(class, null, ConfigurationService)
|
|
handleNoType(ConfigurationService)
|
|
handleClassExtends(null, 1)
|
|
handleClassNoWithClause()
|
|
handleClassOrMixinImplements(null, 0)
|
|
handleClassHeader(class, class, null)
|
|
beginClassOrMixinBody(DeclarationKind.Class, {)
|
|
beginMetadataStar(Configuration)
|
|
endMetadataStar(0)
|
|
beginMember()
|
|
beginFields({)
|
|
handleIdentifier(Configuration, typeReference)
|
|
handleNoTypeArguments(_configuration)
|
|
handleType(Configuration, null)
|
|
handleIdentifier(_configuration, fieldDeclaration)
|
|
handleNoFieldInitializer(;)
|
|
endClassFields(null, null, null, null, null, null, 1, Configuration, ;)
|
|
endMember()
|
|
beginMetadataStar(ConfigurationService)
|
|
endMetadataStar(0)
|
|
beginMember()
|
|
beginMethod(null, null, null, null, null, ConfigurationService)
|
|
handleNoType(;)
|
|
handleIdentifier(ConfigurationService, methodDeclaration)
|
|
handleNoTypeVariables(()
|
|
beginFormalParameters((, MemberKind.NonStaticMethod)
|
|
beginMetadataStar(Configuration)
|
|
endMetadataStar(0)
|
|
beginFormalParameter(Configuration, MemberKind.NonStaticMethod, null, null, null)
|
|
handleIdentifier(Configuration, typeReference)
|
|
handleNoTypeArguments(configuration)
|
|
handleType(Configuration, null)
|
|
handleIdentifier(configuration, formalParameterDeclaration)
|
|
handleFormalParameterWithoutValue())
|
|
endFormalParameter(null, null, configuration, null, null, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
|
|
endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
|
|
beginInitializers(:)
|
|
beginInitializer(assert)
|
|
beginAssert(assert, Assert.Initializer)
|
|
handleIdentifier(configuration, expression)
|
|
handleNoTypeArguments(!=)
|
|
handleNoArguments(!=)
|
|
handleSend(configuration, !=)
|
|
beginBinaryExpression(!=)
|
|
handleLiteralNull(null)
|
|
endBinaryExpression(!=)
|
|
endAssert(assert, Assert.Initializer, (, null, ,)
|
|
endInitializer(,)
|
|
beginInitializer(_configuration)
|
|
handleIdentifier(_configuration, expression)
|
|
handleNoTypeArguments(=)
|
|
handleNoArguments(=)
|
|
handleSend(_configuration, =)
|
|
handleIdentifier(configuration, expression)
|
|
handleNoTypeArguments({)
|
|
handleNoArguments({)
|
|
handleSend(configuration, {)
|
|
handleAssignmentExpression(=)
|
|
endInitializer({)
|
|
endInitializers(2, :, {)
|
|
handleAsyncModifier(null, null)
|
|
beginBlockFunctionBody({)
|
|
endBlockFunctionBody(0, {, })
|
|
endClassConstructor(null, ConfigurationService, (, :, })
|
|
endMember()
|
|
beginMetadataStar(void)
|
|
endMetadataStar(0)
|
|
beginMember()
|
|
beginMethod(null, null, null, null, set, configuration)
|
|
handleVoidKeyword(void)
|
|
handleIdentifier(configuration, methodDeclaration)
|
|
handleNoTypeVariables(()
|
|
beginFormalParameters((, MemberKind.NonStaticMethod)
|
|
beginMetadataStar(Configuration)
|
|
endMetadataStar(0)
|
|
beginFormalParameter(Configuration, MemberKind.NonStaticMethod, null, null, null)
|
|
handleIdentifier(Configuration, typeReference)
|
|
handleNoTypeArguments(configuration)
|
|
handleType(Configuration, null)
|
|
handleIdentifier(configuration, formalParameterDeclaration)
|
|
handleFormalParameterWithoutValue())
|
|
endFormalParameter(null, null, configuration, null, null, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
|
|
endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
|
|
beginInitializers(:)
|
|
beginInitializer(assert)
|
|
beginAssert(assert, Assert.Initializer)
|
|
handleIdentifier(configuration, expression)
|
|
handleNoTypeArguments(!=)
|
|
handleNoArguments(!=)
|
|
handleSend(configuration, !=)
|
|
beginBinaryExpression(!=)
|
|
handleLiteralNull(null)
|
|
endBinaryExpression(!=)
|
|
endAssert(assert, Assert.Initializer, (, null, ,)
|
|
endInitializer(,)
|
|
beginInitializer(_configuration)
|
|
handleIdentifier(_configuration, expression)
|
|
handleNoTypeArguments(=)
|
|
handleNoArguments(=)
|
|
handleSend(_configuration, =)
|
|
handleIdentifier(configuration, expression)
|
|
handleNoTypeArguments({)
|
|
handleNoArguments({)
|
|
handleSend(configuration, {)
|
|
handleAssignmentExpression(=)
|
|
endInitializer({)
|
|
endInitializers(2, :, {)
|
|
handleAsyncModifier(null, null)
|
|
beginBlockFunctionBody({)
|
|
endBlockFunctionBody(0, {, })
|
|
handleRecoverableError(ConstructorWithWrongName, configuration, configuration)
|
|
handleRecoverableError(SetterConstructor, set, set)
|
|
handleRecoverableError(ConstructorWithReturnType, void, void)
|
|
endClassConstructor(set, void, (, :, })
|
|
endMember()
|
|
beginMetadataStar(Configuration)
|
|
endMetadataStar(0)
|
|
beginMember()
|
|
beginMethod(null, null, null, null, get, configuration)
|
|
handleIdentifier(Configuration, typeReference)
|
|
handleNoTypeArguments(get)
|
|
handleType(Configuration, null)
|
|
handleIdentifier(configuration, methodDeclaration)
|
|
handleNoTypeVariables(:)
|
|
handleRecoverableError(MissingMethodParameters, configuration, configuration)
|
|
beginFormalParameters((, MemberKind.NonStaticMethod)
|
|
endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
|
|
beginInitializers(:)
|
|
beginInitializer(assert)
|
|
beginAssert(assert, Assert.Initializer)
|
|
handleIdentifier(_configuration, expression)
|
|
handleNoTypeArguments(!=)
|
|
handleNoArguments(!=)
|
|
handleSend(_configuration, !=)
|
|
beginBinaryExpression(!=)
|
|
handleLiteralNull(null)
|
|
endBinaryExpression(!=)
|
|
endAssert(assert, Assert.Initializer, (, null, ,)
|
|
endInitializer(,)
|
|
beginInitializer(_configuration)
|
|
handleIdentifier(_configuration, expression)
|
|
handleNoTypeArguments(=)
|
|
handleNoArguments(=)
|
|
handleSend(_configuration, =)
|
|
handleIdentifier(_configuration, expression)
|
|
handleNoTypeArguments(.)
|
|
handleNoArguments(.)
|
|
handleSend(_configuration, .)
|
|
handleIdentifier(foo, expressionContinuation)
|
|
handleNoTypeArguments({)
|
|
handleNoArguments({)
|
|
handleSend(foo, {)
|
|
handleEndingBinaryExpression(.)
|
|
handleAssignmentExpression(=)
|
|
endInitializer({)
|
|
endInitializers(2, :, {)
|
|
handleAsyncModifier(null, null)
|
|
beginBlockFunctionBody({)
|
|
beginReturnStatement(return)
|
|
handleIdentifier(_configuration, expression)
|
|
handleNoTypeArguments(;)
|
|
handleNoArguments(;)
|
|
handleSend(_configuration, ;)
|
|
endReturnStatement(true, return, ;)
|
|
endBlockFunctionBody(1, {, })
|
|
handleRecoverableError(ConstructorWithWrongName, configuration, configuration)
|
|
handleRecoverableError(GetterConstructor, get, get)
|
|
handleRecoverableError(ConstructorWithReturnType, Configuration, Configuration)
|
|
endClassConstructor(get, Configuration, (, :, })
|
|
endMember()
|
|
beginMetadataStar(void)
|
|
endMetadataStar(0)
|
|
beginMember()
|
|
beginMethod(null, null, null, null, null, method)
|
|
handleVoidKeyword(void)
|
|
handleIdentifier(method, methodDeclaration)
|
|
handleNoTypeVariables(()
|
|
beginFormalParameters((, MemberKind.NonStaticMethod)
|
|
endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
|
|
beginInitializers(:)
|
|
beginInitializer(_configuration)
|
|
handleIdentifier(_configuration, expression)
|
|
handleNoTypeArguments(=)
|
|
handleNoArguments(=)
|
|
handleSend(_configuration, =)
|
|
handleLiteralNull(null)
|
|
handleAssignmentExpression(=)
|
|
endInitializer({)
|
|
endInitializers(1, :, {)
|
|
handleAsyncModifier(null, null)
|
|
beginBlockFunctionBody({)
|
|
endBlockFunctionBody(0, {, })
|
|
handleRecoverableError(ConstructorWithWrongName, method, method)
|
|
handleRecoverableError(ConstructorWithReturnType, void, void)
|
|
endClassConstructor(null, void, (, :, })
|
|
endMember()
|
|
beginMetadataStar(Foo)
|
|
endMetadataStar(0)
|
|
beginMember()
|
|
beginMethod(null, null, null, null, null, Foo)
|
|
handleNoType(})
|
|
handleIdentifier(Foo, methodDeclaration)
|
|
handleNoTypeVariables(()
|
|
beginFormalParameters((, MemberKind.NonStaticMethod)
|
|
endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
|
|
beginInitializers(:)
|
|
beginInitializer(_configuration)
|
|
handleIdentifier(_configuration, expression)
|
|
handleNoTypeArguments(=)
|
|
handleNoArguments(=)
|
|
handleSend(_configuration, =)
|
|
handleLiteralNull(null)
|
|
handleAssignmentExpression(=)
|
|
endInitializer({)
|
|
endInitializers(1, :, {)
|
|
handleAsyncModifier(null, null)
|
|
beginBlockFunctionBody({)
|
|
endBlockFunctionBody(0, {, })
|
|
handleRecoverableError(ConstructorWithWrongName, Foo, Foo)
|
|
endClassConstructor(null, Foo, (, :, })
|
|
endMember()
|
|
endClassOrMixinBody(DeclarationKind.Class, 6, {, })
|
|
endClassDeclaration(class, })
|
|
endTopLevelDeclaration(class)
|
|
beginMetadataStar(class)
|
|
endMetadataStar(0)
|
|
beginClassOrNamedMixinApplicationPrelude(class)
|
|
handleIdentifier(Configuration, classOrMixinDeclaration)
|
|
handleNoTypeVariables({)
|
|
beginClassDeclaration(class, null, Configuration)
|
|
handleNoType(Configuration)
|
|
handleClassExtends(null, 1)
|
|
handleClassNoWithClause()
|
|
handleClassOrMixinImplements(null, 0)
|
|
handleClassHeader(class, class, null)
|
|
beginClassOrMixinBody(DeclarationKind.Class, {)
|
|
beginMetadataStar(Configuration)
|
|
endMetadataStar(0)
|
|
beginMember()
|
|
beginMethod(null, null, null, null, get, foo)
|
|
handleIdentifier(Configuration, typeReference)
|
|
handleNoTypeArguments(get)
|
|
handleType(Configuration, null)
|
|
handleIdentifier(foo, methodDeclaration)
|
|
handleNoTypeVariables(=>)
|
|
handleNoFormalParameters(=>, MemberKind.NonStaticMethod)
|
|
handleNoInitializers()
|
|
handleAsyncModifier(null, null)
|
|
handleThisExpression(this, expression)
|
|
handleExpressionFunctionBody(=>, ;)
|
|
endClassMethod(get, Configuration, =>, null, ;)
|
|
endMember()
|
|
endClassOrMixinBody(DeclarationKind.Class, 1, {, })
|
|
endClassDeclaration(class, })
|
|
endTopLevelDeclaration()
|
|
endCompilationUnit(2, )
|