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

Side by Side Diff: pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart

Issue 2752853002: Improve printing of generic function types and add tests (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.testing.ast_test_factory; 5 library analyzer.src.generated.testing.ast_test_factory;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 function, typeArguments, argumentList(arguments)); 605 function, typeArguments, argumentList(arguments));
606 606
607 static FunctionTypedFormalParameter functionTypedFormalParameter( 607 static FunctionTypedFormalParameter functionTypedFormalParameter(
608 TypeAnnotation returnType, String identifier, 608 TypeAnnotation returnType, String identifier,
609 [List<FormalParameter> parameters]) => 609 [List<FormalParameter> parameters]) =>
610 astFactory.functionTypedFormalParameter2( 610 astFactory.functionTypedFormalParameter2(
611 returnType: returnType, 611 returnType: returnType,
612 identifier: identifier3(identifier), 612 identifier: identifier3(identifier),
613 parameters: formalParameterList(parameters)); 613 parameters: formalParameterList(parameters));
614 614
615 static GenericFunctionType genericFunctionType(TypeAnnotation returnType,
616 TypeParameterList typeParameters, FormalParameterList parameters) =>
617 astFactory.genericFunctionType(returnType,
618 TokenFactory.tokenFromString("Function"), typeParameters, parameters);
619
620 static GenericTypeAlias genericTypeAlias(String name,
621 TypeParameterList typeParameters, GenericFunctionType functionType) =>
622 astFactory.genericTypeAlias(
623 null,
624 null,
625 TokenFactory.tokenFromKeyword(Keyword.TYPEDEF),
626 identifier3(name),
627 typeParameters,
628 TokenFactory.tokenFromType(TokenType.EQ),
629 functionType,
630 TokenFactory.tokenFromType(TokenType.SEMICOLON));
631
615 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => 632 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) =>
616 astFactory.hideCombinator( 633 astFactory.hideCombinator(
617 TokenFactory.tokenFromString("hide"), identifiers); 634 TokenFactory.tokenFromString("hide"), identifiers);
618 635
619 static HideCombinator hideCombinator2(List<String> identifiers) => 636 static HideCombinator hideCombinator2(List<String> identifiers) =>
620 astFactory.hideCombinator( 637 astFactory.hideCombinator(
621 TokenFactory.tokenFromString("hide"), identifierList(identifiers)); 638 TokenFactory.tokenFromString("hide"), identifierList(identifiers));
622 639
623 static PrefixedIdentifier identifier( 640 static PrefixedIdentifier identifier(
624 SimpleIdentifier prefix, SimpleIdentifier identifier) => 641 SimpleIdentifier prefix, SimpleIdentifier identifier) =>
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 static SimpleFormalParameter simpleFormalParameter( 1079 static SimpleFormalParameter simpleFormalParameter(
1063 Keyword keyword, String parameterName) => 1080 Keyword keyword, String parameterName) =>
1064 simpleFormalParameter2(keyword, null, parameterName); 1081 simpleFormalParameter2(keyword, null, parameterName);
1065 1082
1066 static SimpleFormalParameter simpleFormalParameter2( 1083 static SimpleFormalParameter simpleFormalParameter2(
1067 Keyword keyword, TypeAnnotation type, String parameterName) => 1084 Keyword keyword, TypeAnnotation type, String parameterName) =>
1068 astFactory.simpleFormalParameter2( 1085 astFactory.simpleFormalParameter2(
1069 keyword: 1086 keyword:
1070 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), 1087 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
1071 type: type, 1088 type: type,
1072 identifier: identifier3(parameterName)); 1089 identifier:
1090 parameterName == null ? null : identifier3(parameterName));
1073 1091
1074 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => 1092 static SimpleFormalParameter simpleFormalParameter3(String parameterName) =>
1075 simpleFormalParameter2(null, null, parameterName); 1093 simpleFormalParameter2(null, null, parameterName);
1076 1094
1077 static SimpleFormalParameter simpleFormalParameter4( 1095 static SimpleFormalParameter simpleFormalParameter4(
1078 TypeAnnotation type, String parameterName) => 1096 TypeAnnotation type, String parameterName) =>
1079 simpleFormalParameter2(null, type, parameterName); 1097 simpleFormalParameter2(null, type, parameterName);
1080 1098
1081 static StringInterpolation string([List<InterpolationElement> elements]) => 1099 static StringInterpolation string([List<InterpolationElement> elements]) =>
1082 astFactory.stringInterpolation(elements); 1100 astFactory.stringInterpolation(elements);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 expression, 1332 expression,
1315 TokenFactory.tokenFromType(TokenType.SEMICOLON)); 1333 TokenFactory.tokenFromType(TokenType.SEMICOLON));
1316 1334
1317 static YieldStatement yieldStatement(Expression expression) => 1335 static YieldStatement yieldStatement(Expression expression) =>
1318 astFactory.yieldStatement( 1336 astFactory.yieldStatement(
1319 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), 1337 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"),
1320 null, 1338 null,
1321 expression, 1339 expression,
1322 TokenFactory.tokenFromType(TokenType.SEMICOLON)); 1340 TokenFactory.tokenFromType(TokenType.SEMICOLON));
1323 } 1341 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | pkg/analyzer/test/src/dart/ast/utilities_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698