Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3863)

Unified Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 2814183002: Fix another parser issue with generic function types (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 15b94b78b1cee37b1a30fda4633571e423752678..3f0130fb09153a8237b313a14ccee0df36a1381c 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -10040,6 +10040,17 @@ class SimpleParserTest extends ParserTestCase {
expect(arguments, hasLength(3));
}
+ void test_parseClassMember_field_gftType_gftReturnType() {
+ createParser('''
+Function(int) Function(String) v;
+''');
+ ClassMember member = parser.parseClassMember('C');
+ listener.assertNoErrors();
+ expect(member, new isInstanceOf<FieldDeclaration>());
+ VariableDeclarationList fields = (member as FieldDeclaration).fields;
+ expect(fields.type, new isInstanceOf<GenericFunctionType>());
+ }
+
void test_parseClassMember_field_gftType_noReturnType() {
createParser('''
Function(int, String) v;
@@ -10693,6 +10704,19 @@ Function<A>(core.List<core.int> x) f() => null;
expect(unit.declarations, hasLength(1));
}
+ void test_parseCompilationUnitMember_variable_gftType_gftReturnType() {
+ createParser('''
+Function(int) Function(String) v;
+''');
+ CompilationUnit unit = parser.parseCompilationUnit2();
+ listener.assertNoErrors();
+ expect(unit, isNotNull);
+ expect(unit.declarations, hasLength(1));
+ TopLevelVariableDeclaration declaration =
+ unit.declarations[0] as TopLevelVariableDeclaration;
+ expect(declaration.variables.type, new isInstanceOf<GenericFunctionType>());
+ }
+
void test_parseCompilationUnitMember_variable_gftType_noReturnType() {
createParser('''
Function(int, String) v;
@@ -11325,6 +11349,14 @@ Function(int, String) v;
}
void
+ test_parseNonLabeledStatement_variableDeclaration_gftType_gftReturnType() {
+ createParser('Function(int) Function(int) v;');
+ Statement statement = parser.parseNonLabeledStatement();
+ expectNotNullIfNoErrors(statement);
+ listener.assertNoErrors();
+ }
+
+ void
test_parseNonLabeledStatement_variableDeclaration_gftType_noReturnType() {
createParser('Function(int) v;');
Statement statement = parser.parseNonLabeledStatement();
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698