mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 15:57:17 +00:00
[CFE] Parser test framework
Change-Id: I1f27b380a2e6f8ea34d8ce66de6d581a1da8bf96 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118572 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
cff2b10a28
commit
acfda5d837
|
@ -9,6 +9,7 @@ analyzer:
|
|||
- test/flow_analysis/nullability/data/**
|
||||
- test/flow_analysis/reachability/data/**
|
||||
- test/flow_analysis/type_promotion/data/**
|
||||
- parser_testcases/**
|
||||
- testcases/**
|
||||
- test/id_testing/data/**
|
||||
- test/language_versioning/data/**
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
f() { foo.bar!.baz[arg]; }
|
|
@ -0,0 +1,37 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(.)
|
||||
handleNoArguments(.)
|
||||
handleSend(foo, .)
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(bar, !)
|
||||
endBinaryExpression(.)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleIdentifier(baz, expressionContinuation)
|
||||
handleNoTypeArguments([)
|
||||
handleNoArguments([)
|
||||
handleSend(baz, [)
|
||||
endBinaryExpression(.)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { (foo.bar)!.baz[arg]; }
|
|
@ -0,0 +1,38 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(.)
|
||||
handleNoArguments(.)
|
||||
handleSend(foo, .)
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(bar, ))
|
||||
endBinaryExpression(.)
|
||||
handleParenthesizedExpression(()
|
||||
handleNonNullAssertExpression(!)
|
||||
handleIdentifier(baz, expressionContinuation)
|
||||
handleNoTypeArguments([)
|
||||
handleNoArguments([)
|
||||
handleSend(baz, [)
|
||||
endBinaryExpression(.)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { obj![arg]; }
|
|
@ -0,0 +1,27 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(obj, expression)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleNoTypeArguments([)
|
||||
handleNoArguments([)
|
||||
handleSend(obj, [)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { obj![arg]![arg2]; }
|
|
@ -0,0 +1,33 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(obj, expression)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleNoTypeArguments([)
|
||||
handleNoArguments([)
|
||||
handleSend(obj, [)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleNonNullAssertExpression(!)
|
||||
handleIdentifier(arg2, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg2, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { (((obj!)[arg])!)[arg2]; }
|
|
@ -0,0 +1,36 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(obj, expression)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(obj, !)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleParenthesizedExpression(()
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(arg2, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg2, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { foo.bar![arg]; }
|
|
@ -0,0 +1,32 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(.)
|
||||
handleNoArguments(.)
|
||||
handleSend(foo, .)
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleNoTypeArguments([)
|
||||
handleNoArguments([)
|
||||
handleSend(bar, [)
|
||||
endBinaryExpression(.)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { (foo.bar)![arg]; }
|
|
@ -0,0 +1,33 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(.)
|
||||
handleNoArguments(.)
|
||||
handleSend(foo, .)
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNoTypeArguments())
|
||||
handleNoArguments())
|
||||
handleSend(bar, ))
|
||||
endBinaryExpression(.)
|
||||
handleParenthesizedExpression(()
|
||||
handleNonNullAssertExpression(!)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { foo!.bar![arg]; }
|
|
@ -0,0 +1,33 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(foo, !)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleNoTypeArguments([)
|
||||
handleNoArguments([)
|
||||
handleSend(bar, [)
|
||||
endBinaryExpression(.)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { ((foo!).bar!)[arg]; }
|
|
@ -0,0 +1,35 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(foo, !)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(bar, !)
|
||||
endBinaryExpression(.)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { foo.bar![arg]![arg2]; }
|
|
@ -0,0 +1,38 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(.)
|
||||
handleNoArguments(.)
|
||||
handleSend(foo, .)
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleNoTypeArguments([)
|
||||
handleNoArguments([)
|
||||
handleSend(bar, [)
|
||||
endBinaryExpression(.)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleNonNullAssertExpression(!)
|
||||
handleIdentifier(arg2, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg2, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { (((foo.bar!)[arg])!)[arg2]; }
|
|
@ -0,0 +1,41 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(.)
|
||||
handleNoArguments(.)
|
||||
handleSend(foo, .)
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(bar, !)
|
||||
endBinaryExpression(.)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleParenthesizedExpression(()
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(arg2, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg2, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { foo!.bar![arg]![arg2]; }
|
|
@ -0,0 +1,39 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(foo, !)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleNoTypeArguments([)
|
||||
handleNoArguments([)
|
||||
handleSend(bar, [)
|
||||
endBinaryExpression(.)
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleNonNullAssertExpression(!)
|
||||
handleIdentifier(arg2, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg2, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { ((((foo!).bar!)[arg])!)[arg2]; }
|
|
@ -0,0 +1,43 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(foo, expression)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(foo, !)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(bar, expressionContinuation)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(bar, !)
|
||||
endBinaryExpression(.)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleParenthesizedExpression(()
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(arg2, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg2, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
|
@ -0,0 +1 @@
|
|||
f() { (obj!)[arg]; }
|
|
@ -0,0 +1,28 @@
|
|||
beginCompilationUnit(f)
|
||||
beginMetadataStar(f)
|
||||
endMetadataStar(0)
|
||||
beginTopLevelMember(f)
|
||||
beginTopLevelMethod(, null)
|
||||
handleNoType()
|
||||
handleIdentifier(f, topLevelFunctionDeclaration)
|
||||
handleNoTypeVariables(()
|
||||
beginFormalParameters((, MemberKind.TopLevelMethod)
|
||||
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
||||
handleAsyncModifier(null, null)
|
||||
beginBlockFunctionBody({)
|
||||
handleIdentifier(obj, expression)
|
||||
handleNoTypeArguments(!)
|
||||
handleNoArguments(!)
|
||||
handleSend(obj, !)
|
||||
handleNonNullAssertExpression(!)
|
||||
handleParenthesizedExpression(()
|
||||
handleIdentifier(arg, expression)
|
||||
handleNoTypeArguments(])
|
||||
handleNoArguments(])
|
||||
handleSend(arg, ])
|
||||
handleIndexedExpression([, ])
|
||||
handleExpressionStatement(;)
|
||||
endBlockFunctionBody(1, {, })
|
||||
endTopLevelMethod(f, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(1, )
|
3
pkg/front_end/parser_testcases/parser.status
Normal file
3
pkg/front_end/parser_testcases/parser.status
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE.md file.
|
96
pkg/front_end/test/parser_test.dart
Normal file
96
pkg/front_end/test/parser_test.dart
Normal file
|
@ -0,0 +1,96 @@
|
|||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'dart:async' show Future;
|
||||
|
||||
import 'dart:convert' show jsonDecode;
|
||||
|
||||
import 'dart:io' show File;
|
||||
|
||||
import 'dart:typed_data' show Uint8List;
|
||||
|
||||
import 'package:front_end/src/fasta/parser.dart' show Parser;
|
||||
|
||||
import 'package:front_end/src/fasta/scanner/utf8_bytes_scanner.dart'
|
||||
show Utf8BytesScanner;
|
||||
|
||||
import 'package:front_end/src/scanner/token.dart' show Token;
|
||||
|
||||
import 'package:testing/testing.dart'
|
||||
show
|
||||
Chain,
|
||||
ChainContext,
|
||||
ExpectationSet,
|
||||
Result,
|
||||
Step,
|
||||
TestDescription,
|
||||
runMe;
|
||||
|
||||
import 'utils/kernel_chain.dart' show MatchContext;
|
||||
|
||||
import 'parser_test_listener.dart' show ParserTestListener;
|
||||
|
||||
const String EXPECTATIONS = '''
|
||||
[
|
||||
{
|
||||
"name": "ExpectationFileMismatch",
|
||||
"group": "Fail"
|
||||
},
|
||||
{
|
||||
"name": "ExpectationFileMissing",
|
||||
"group": "Fail"
|
||||
}
|
||||
]
|
||||
''';
|
||||
|
||||
main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<Context> createContext(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
return new Context(environment["updateExpectations"] == "true");
|
||||
}
|
||||
|
||||
class Context extends ChainContext with MatchContext {
|
||||
final updateExpectations;
|
||||
|
||||
Context(this.updateExpectations);
|
||||
|
||||
final List<Step> steps = const <Step>[
|
||||
const ParserStep(),
|
||||
];
|
||||
|
||||
final ExpectationSet expectationSet =
|
||||
new ExpectationSet.fromJsonList(jsonDecode(EXPECTATIONS));
|
||||
}
|
||||
|
||||
class ParserStep extends Step<TestDescription, TestDescription, Context> {
|
||||
const ParserStep();
|
||||
|
||||
String get name => "parser";
|
||||
|
||||
Future<Result<TestDescription>> run(
|
||||
TestDescription description, Context context) async {
|
||||
File f = new File.fromUri(description.uri);
|
||||
List<int> rawBytes = f.readAsBytesSync();
|
||||
|
||||
Uint8List bytes = new Uint8List(rawBytes.length + 1);
|
||||
bytes.setRange(0, rawBytes.length, rawBytes);
|
||||
|
||||
Utf8BytesScanner scanner =
|
||||
new Utf8BytesScanner(bytes, includeComments: true);
|
||||
Token firstToken = scanner.tokenize();
|
||||
|
||||
if (firstToken == null) {
|
||||
return crash(description, StackTrace.current);
|
||||
}
|
||||
|
||||
ParserTestListener parserTestListener = new ParserTestListener();
|
||||
Parser parser = new Parser(parserTestListener);
|
||||
parser.parseUnit(firstToken);
|
||||
|
||||
return context.match<TestDescription>(
|
||||
".expect", "${parserTestListener.sb}", description.uri, description);
|
||||
}
|
||||
}
|
1640
pkg/front_end/test/parser_test_listener.dart
Normal file
1640
pkg/front_end/test/parser_test_listener.dart
Normal file
File diff suppressed because it is too large
Load diff
140
pkg/front_end/test/parser_test_listener_creator.dart
Normal file
140
pkg/front_end/test/parser_test_listener_creator.dart
Normal file
|
@ -0,0 +1,140 @@
|
|||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:front_end/src/fasta/parser.dart';
|
||||
import 'package:front_end/src/fasta/parser/formal_parameter_kind.dart';
|
||||
import 'package:front_end/src/fasta/parser/listener.dart';
|
||||
import 'package:front_end/src/fasta/parser/member_kind.dart';
|
||||
import 'package:front_end/src/fasta/scanner/utf8_bytes_scanner.dart';
|
||||
import 'package:front_end/src/scanner/token.dart';
|
||||
|
||||
main() {
|
||||
File f = new File.fromUri(
|
||||
Platform.script.resolve("../lib/src/fasta/parser/listener.dart"));
|
||||
List<int> rawBytes = f.readAsBytesSync();
|
||||
|
||||
Uint8List bytes = new Uint8List(rawBytes.length + 1);
|
||||
bytes.setRange(0, rawBytes.length, rawBytes);
|
||||
|
||||
Utf8BytesScanner scanner = new Utf8BytesScanner(bytes, includeComments: true);
|
||||
Token firstToken = scanner.tokenize();
|
||||
|
||||
print("""
|
||||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:front_end/src/fasta/messages.dart';
|
||||
import 'package:front_end/src/fasta/parser/assert.dart';
|
||||
import 'package:front_end/src/fasta/parser/declaration_kind.dart';
|
||||
import 'package:front_end/src/fasta/parser/formal_parameter_kind.dart';
|
||||
import 'package:front_end/src/fasta/parser/identifier_context.dart';
|
||||
import 'package:front_end/src/fasta/parser/listener.dart';
|
||||
import 'package:front_end/src/fasta/parser/member_kind.dart';
|
||||
import 'package:front_end/src/fasta/scanner/error_token.dart';
|
||||
import 'package:front_end/src/scanner/token.dart';
|
||||
|
||||
// THIS FILE IS AUTO GENERATED BY 'test/parser_test_listener_creator.dart'
|
||||
|
||||
class ParserTestListener implements Listener {
|
||||
int indent = 0;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
void doPrint(String s) {
|
||||
sb.writeln((" " * indent) + s);
|
||||
}
|
||||
""");
|
||||
|
||||
ParserCreatorListener listener = new ParserCreatorListener();
|
||||
ClassMemberParser parser = new ClassMemberParser(listener);
|
||||
parser.parseUnit(firstToken);
|
||||
|
||||
print("""
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
class ParserCreatorListener extends Listener {
|
||||
bool insideListenerClass = false;
|
||||
String currentMethodName;
|
||||
List<String> parameters = <String>[];
|
||||
|
||||
void beginClassDeclaration(Token begin, Token abstractToken, Token name) {
|
||||
if (name.lexeme == "Listener") insideListenerClass = true;
|
||||
}
|
||||
|
||||
void endClassDeclaration(Token beginToken, Token endToken) {
|
||||
insideListenerClass = false;
|
||||
}
|
||||
|
||||
void beginMethod(Token externalToken, Token staticToken, Token covariantToken,
|
||||
Token varFinalOrConst, Token getOrSet, Token name) {
|
||||
currentMethodName = name.lexeme;
|
||||
}
|
||||
|
||||
void endClassMethod(Token getOrSet, Token beginToken, Token beginParam,
|
||||
Token beginInitializers, Token endToken) {
|
||||
if (insideListenerClass) {
|
||||
Token token = beginToken;
|
||||
Token latestToken;
|
||||
while (true) {
|
||||
if (latestToken != null && latestToken.charEnd < token.charOffset) {
|
||||
stdout.write(" ");
|
||||
}
|
||||
stdout.write(token.lexeme);
|
||||
if ((token is BeginToken &&
|
||||
token.type == TokenType.OPEN_CURLY_BRACKET) ||
|
||||
token is SimpleToken && token.type == TokenType.FUNCTION) {
|
||||
break;
|
||||
}
|
||||
if (token == endToken) {
|
||||
throw token.runtimeType;
|
||||
}
|
||||
latestToken = token;
|
||||
token = token.next;
|
||||
}
|
||||
|
||||
if (token is SimpleToken && token.type == TokenType.FUNCTION) {
|
||||
stdout.write(" null;");
|
||||
} else {
|
||||
stdout.write("\n");
|
||||
if (currentMethodName.startsWith("end")) {
|
||||
stdout.write("indent--;\n");
|
||||
}
|
||||
stdout.write("doPrint('$currentMethodName(");
|
||||
String separator = "";
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
stdout.write(separator);
|
||||
stdout.write(r"''$");
|
||||
stdout.write(parameters[i]);
|
||||
separator = ", ";
|
||||
}
|
||||
stdout.write(")');\n");
|
||||
|
||||
if (currentMethodName.startsWith("begin")) {
|
||||
stdout.write("indent++;\n");
|
||||
}
|
||||
|
||||
stdout.write("}");
|
||||
}
|
||||
stdout.write("\n\n");
|
||||
}
|
||||
parameters.clear();
|
||||
currentMethodName = null;
|
||||
}
|
||||
|
||||
void endFormalParameter(
|
||||
Token thisKeyword,
|
||||
Token periodAfterThis,
|
||||
Token nameToken,
|
||||
Token initializerStart,
|
||||
Token initializerEnd,
|
||||
FormalParameterKind kind,
|
||||
MemberKind memberKind) {
|
||||
parameters.add(nameToken.lexeme);
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@ approval
|
|||
approximation
|
||||
asserter
|
||||
auth
|
||||
auto
|
||||
autobianchi
|
||||
b0x
|
||||
b1x
|
||||
|
|
|
@ -176,6 +176,17 @@
|
|||
],
|
||||
"exclude": []
|
||||
},
|
||||
{
|
||||
"name": "parser_test",
|
||||
"kind": "Chain",
|
||||
"source": "test/parser_test.dart",
|
||||
"path": "parser_testcases/",
|
||||
"status": "parser_testcases/parser.status",
|
||||
"pattern": [
|
||||
"\\.dart$"
|
||||
],
|
||||
"exclude": []
|
||||
},
|
||||
{
|
||||
"name": "lint_test",
|
||||
"kind": "Chain",
|
||||
|
|
Loading…
Reference in a new issue