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

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

Issue 1560663004: Parse generic function declarations with/without type. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 96a4b3e5a0af5968fbc164099b26e3820c9c908b..0f43183782bffbe9b6ba5cdccc81468b95a7294f 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -7038,6 +7038,30 @@ void''');
expect(declaration.propertyKeyword, isNull);
}
+ void test_parseCompilationUnitMember_function_generic_noReturnType() {
+ enableGenericMethods = true;
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "f<E>() {}");
+ expect(declaration.returnType, isNull);
+ expect(declaration.functionExpression.typeParameters, isNotNull);
+ }
+
+ void test_parseCompilationUnitMember_function_generic_returnType() {
+ enableGenericMethods = true;
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "E f<E>() {}");
+ expect(declaration.returnType, isNotNull);
+ expect(declaration.functionExpression.typeParameters, isNotNull);
+ }
+
+ void test_parseCompilationUnitMember_function_generic_void() {
+ enableGenericMethods = true;
+ FunctionDeclaration declaration = parse("parseCompilationUnitMember",
+ <Object>[emptyCommentAndMetadata()], "void f<T>(T t) {}");
+ expect(declaration.functionExpression, isNotNull);
+ expect(declaration.propertyKeyword, isNull);
+ }
+
void test_parseCompilationUnitMember_function_noType() {
FunctionDeclaration declaration = parse("parseCompilationUnitMember",
<Object>[emptyCommentAndMetadata()], "f() {}");
@@ -7058,14 +7082,6 @@ void''');
expect(declaration.returnType, isNotNull);
}
- void test_parseCompilationUnitMember_function_withTypeParameters() {
- enableGenericMethods = true;
- FunctionDeclaration declaration = parse("parseCompilationUnitMember",
- <Object>[emptyCommentAndMetadata()], "void f<T>(T t) {}");
- expect(declaration.functionExpression, isNotNull);
- expect(declaration.propertyKeyword, isNull);
- }
-
void test_parseCompilationUnitMember_getter_external_noType() {
FunctionDeclaration declaration = parse("parseCompilationUnitMember",
<Object>[emptyCommentAndMetadata()], "external get p;");
« 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