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

Side by Side Diff: pkg/analyzer/lib/dart/ast/ast_factory.dart

Issue 2713173003: Add AST factories for formal parameters with all optional named parameters. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « pkg/analyzer/lib/dart/ast/ast.dart ('k') | pkg/analyzer/lib/src/dart/ast/ast.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:analyzer/dart/ast/ast.dart'; 5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/src/generated/utilities_dart.dart'; 6 import 'package:analyzer/src/generated/utilities_dart.dart';
7 import 'package:front_end/src/scanner/token.dart'; 7 import 'package:front_end/src/scanner/token.dart';
8 import 'package:meta/meta.dart';
8 9
9 /** 10 /**
10 * A collection of factory methods which may be used to create concrete 11 * A collection of factory methods which may be used to create concrete
11 * instances of the interfaces that constitute the AST. 12 * instances of the interfaces that constitute the AST.
12 * 13 *
13 * Clients should not extend, implement or mix-in this class. 14 * Clients should not extend, implement or mix-in this class.
14 */ 15 */
15 abstract class AstFactory { 16 abstract class AstFactory {
16 /** 17 /**
17 * Returns a newly created list of adjacent strings. To be syntactically 18 * Returns a newly created list of adjacent strings. To be syntactically
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 * Returns a newly created default formal parameter. The [separator] and 298 * Returns a newly created default formal parameter. The [separator] and
298 * [defaultValue] can be `null` if there is no default value. 299 * [defaultValue] can be `null` if there is no default value.
299 */ 300 */
300 DefaultFormalParameter defaultFormalParameter(NormalFormalParameter parameter, 301 DefaultFormalParameter defaultFormalParameter(NormalFormalParameter parameter,
301 ParameterKind kind, Token separator, Expression defaultValue); 302 ParameterKind kind, Token separator, Expression defaultValue);
302 303
303 /** 304 /**
304 * Returns a documentation comment consisting of the given [tokens] and having 305 * Returns a documentation comment consisting of the given [tokens] and having
305 * the given [references] (if supplied) embedded within it. 306 * the given [references] (if supplied) embedded within it.
306 */ 307 */
307 Comment documentationComment( 308 Comment documentationComment(List<Token> tokens,
308 List<Token> tokens, [List<CommentReference> references]); 309 [List<CommentReference> references]);
309 310
310 /** 311 /**
311 * Returns a newly created do loop. 312 * Returns a newly created do loop.
312 */ 313 */
313 DoStatement doStatement( 314 DoStatement doStatement(
314 Token doKeyword, 315 Token doKeyword,
315 Statement body, 316 Statement body,
316 Token whileKeyword, 317 Token whileKeyword,
317 Token leftParenthesis, 318 Token leftParenthesis,
318 Expression condition, 319 Expression condition,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 413
413 /** 414 /**
414 * Returns a newly created formal parameter. Either or both of the 415 * Returns a newly created formal parameter. Either or both of the
415 * [comment] and [metadata] can be `null` if the parameter does not have the 416 * [comment] and [metadata] can be `null` if the parameter does not have the
416 * corresponding attribute. The [keyword] can be `null` if there is a type. 417 * corresponding attribute. The [keyword] can be `null` if there is a type.
417 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and 418 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
418 * [period] can be `null` if the keyword 'this' was not provided. The 419 * [period] can be `null` if the keyword 'this' was not provided. The
419 * [parameters] can be `null` if this is not a function-typed field formal 420 * [parameters] can be `null` if this is not a function-typed field formal
420 * parameter. 421 * parameter.
421 */ 422 */
422 FieldFormalParameter fieldFormalParameter( 423 FieldFormalParameter fieldFormalParameter(
Paul Berry 2017/02/24 20:29:04 Consider marking as @deprecated and adding a comme
423 Comment comment, 424 Comment comment,
424 List<Annotation> metadata, 425 List<Annotation> metadata,
425 Token keyword, 426 Token keyword,
426 TypeAnnotation type, 427 TypeAnnotation type,
427 Token thisKeyword, 428 Token thisKeyword,
428 Token period, 429 Token period,
429 SimpleIdentifier identifier, 430 SimpleIdentifier identifier,
430 TypeParameterList typeParameters, 431 TypeParameterList typeParameters,
431 FormalParameterList parameters); 432 FormalParameterList parameters);
432 433
433 /** 434 /**
435 * Returns a newly created formal parameter. Either or both of the
436 * [comment] and [metadata] can be `null` if the parameter does not have the
437 * corresponding attribute. The [keyword] can be `null` if there is a type.
438 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
439 * [period] can be `null` if the keyword 'this' was not provided. The
440 * [parameters] can be `null` if this is not a function-typed field formal
441 * parameter.
442 */
443 FieldFormalParameter fieldFormalParameter2(
444 {Comment comment,
445 List<Annotation> metadata,
446 Token covariantKeyword,
447 Token keyword,
448 TypeAnnotation type,
449 @required Token thisKeyword,
450 @required Token period,
451 @required SimpleIdentifier identifier,
452 TypeParameterList typeParameters,
453 FormalParameterList parameters});
454
455 /**
434 * Returns a newly created for-each statement whose loop control variable 456 * Returns a newly created for-each statement whose loop control variable
435 * is declared internally (in the for-loop part). The [awaitKeyword] can be 457 * is declared internally (in the for-loop part). The [awaitKeyword] can be
436 * `null` if this is not an asynchronous for loop. 458 * `null` if this is not an asynchronous for loop.
437 */ 459 */
438 ForEachStatement forEachStatementWithDeclaration( 460 ForEachStatement forEachStatementWithDeclaration(
439 Token awaitKeyword, 461 Token awaitKeyword,
440 Token forKeyword, 462 Token forKeyword,
441 Token leftParenthesis, 463 Token leftParenthesis,
442 DeclaredIdentifier loopVariable, 464 DeclaredIdentifier loopVariable,
443 Token inKeyword, 465 Token inKeyword,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 FunctionTypedFormalParameter functionTypedFormalParameter( 573 FunctionTypedFormalParameter functionTypedFormalParameter(
552 Comment comment, 574 Comment comment,
553 List<Annotation> metadata, 575 List<Annotation> metadata,
554 TypeAnnotation returnType, 576 TypeAnnotation returnType,
555 SimpleIdentifier identifier, 577 SimpleIdentifier identifier,
556 TypeParameterList typeParameters, 578 TypeParameterList typeParameters,
557 FormalParameterList parameters, 579 FormalParameterList parameters,
558 {Token question: null}); 580 {Token question: null});
559 581
560 /** 582 /**
583 * Returns a newly created formal parameter. Either or both of the
584 * [comment] and [metadata] can be `null` if the parameter does not have the
585 * corresponding attribute. The [returnType] can be `null` if no return type
586 * was specified.
587 */
588 FunctionTypedFormalParameter functionTypedFormalParameter2(
589 {Comment comment,
590 List<Annotation> metadata,
591 Token covariantKeyword,
592 TypeAnnotation returnType,
593 @required SimpleIdentifier identifier,
594 TypeParameterList typeParameters,
595 @required FormalParameterList parameters,
596 Token question});
597
598 /**
599 * Initialize a newly created generic function type.
600 */
601 GenericFunctionType genericFunctionType(
602 TypeAnnotation returnType,
603 Token functionKeyword,
604 TypeParameterList typeParameters,
605 FormalParameterList _parameters);
606
607 /**
608 * Returns a newly created generic type alias. Either or both of the
609 * [comment] and [metadata] can be `null` if the variable list does not have
610 * the corresponding attribute. The [typeParameters] can be `null` if there
611 * are no type parameters.
612 */
613 GenericTypeAlias genericTypeAlias(
614 Comment comment,
615 List<Annotation> metadata,
616 Token typedefKeyword,
617 SimpleIdentifier name,
618 TypeParameterList typeParameters,
619 Token equals,
620 GenericFunctionType functionType,
621 Token semicolon);
622
623 /**
561 * Returns a newly created import show combinator. 624 * Returns a newly created import show combinator.
562 */ 625 */
563 HideCombinator hideCombinator( 626 HideCombinator hideCombinator(
564 Token keyword, List<SimpleIdentifier> hiddenNames); 627 Token keyword, List<SimpleIdentifier> hiddenNames);
565 628
566 /** 629 /**
567 * Returns a newly created if statement. The [elseKeyword] and 630 * Returns a newly created if statement. The [elseKeyword] and
568 * [elseStatement] can be `null` if there is no else clause. 631 * [elseStatement] can be `null` if there is no else clause.
569 */ 632 */
570 IfStatement ifStatement( 633 IfStatement ifStatement(
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 * specified. The [type] must be `null` if the keyword is 'var'. 909 * specified. The [type] must be `null` if the keyword is 'var'.
847 */ 910 */
848 SimpleFormalParameter simpleFormalParameter( 911 SimpleFormalParameter simpleFormalParameter(
849 Comment comment, 912 Comment comment,
850 List<Annotation> metadata, 913 List<Annotation> metadata,
851 Token keyword, 914 Token keyword,
852 TypeAnnotation type, 915 TypeAnnotation type,
853 SimpleIdentifier identifier); 916 SimpleIdentifier identifier);
854 917
855 /** 918 /**
919 * Returns a newly created formal parameter. Either or both of the
920 * [comment] and [metadata] can be `null` if the parameter does not have the
921 * corresponding attribute. The [keyword] can be `null` if a type was
922 * specified. The [type] must be `null` if the keyword is 'var'.
923 */
924 SimpleFormalParameter simpleFormalParameter2(
925 {Comment comment,
926 List<Annotation> metadata,
927 Token covariantKeyword,
928 Token keyword,
929 TypeAnnotation type,
930 @required SimpleIdentifier identifier});
931
932 /**
856 * Returns a newly created identifier. 933 * Returns a newly created identifier.
857 */ 934 */
858 SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false}); 935 SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false});
859 936
860 /** 937 /**
861 * Returns a newly created simple string literal. 938 * Returns a newly created simple string literal.
862 */ 939 */
863 SimpleStringLiteral simpleStringLiteral(Token literal, String value); 940 SimpleStringLiteral simpleStringLiteral(Token literal, String value);
864 941
865 /** 942 /**
(...skipping 10 matching lines...) Expand all
876 SuperConstructorInvocation superConstructorInvocation( 953 SuperConstructorInvocation superConstructorInvocation(
877 Token superKeyword, 954 Token superKeyword,
878 Token period, 955 Token period,
879 SimpleIdentifier constructorName, 956 SimpleIdentifier constructorName,
880 ArgumentList argumentList); 957 ArgumentList argumentList);
881 958
882 /** 959 /**
883 * Returns a newly created super expression. 960 * Returns a newly created super expression.
884 */ 961 */
885 SuperExpression superExpression(Token superKeyword); 962 SuperExpression superExpression(Token superKeyword);
886
887 /** 963 /**
Brian Wilkerson 2017/02/24 18:27:59 nit: restore blank line
888 * Returns a newly created switch case. The list of [labels] can be `null` 964 * Returns a newly created switch case. The list of [labels] can be `null`
889 * if there are no labels. 965 * if there are no labels.
890 */ 966 */
891 SwitchCase switchCase(List<Label> labels, Token keyword, 967 SwitchCase switchCase(List<Label> labels, Token keyword,
892 Expression expression, Token colon, List<Statement> statements); 968 Expression expression, Token colon, List<Statement> statements);
893 969
894 /** 970 /**
895 * Returns a newly created switch default. The list of [labels] can be 971 * Returns a newly created switch default. The list of [labels] can be
896 * `null` if there are no labels. 972 * `null` if there are no labels.
897 */ 973 */
898 SwitchDefault switchDefault(List<Label> labels, Token keyword, Token colon, 974 SwitchDefault switchDefault(List<Label> labels, Token keyword, Token colon,
899 List<Statement> statements); 975 List<Statement> statements);
976
900 /** 977 /**
901 * Returns a newly created switch statement. The list of [members] can be 978 * Returns a newly created switch statement. The list of [members] can be
902 * `null` if there are no switch members. 979 * `null` if there are no switch members.
903 */ 980 */
904 SwitchStatement switchStatement( 981 SwitchStatement switchStatement(
905 Token switchKeyword, 982 Token switchKeyword,
906 Token leftParenthesis, 983 Token leftParenthesis,
907 Expression expression, 984 Expression expression,
908 Token rightParenthesis, 985 Token rightParenthesis,
909 Token leftBracket, 986 Token leftBracket,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 * specified. The [type] must be `null` if the keyword is 'var'. 1063 * specified. The [type] must be `null` if the keyword is 'var'.
987 */ 1064 */
988 VariableDeclarationList variableDeclarationList( 1065 VariableDeclarationList variableDeclarationList(
989 Comment comment, 1066 Comment comment,
990 List<Annotation> metadata, 1067 List<Annotation> metadata,
991 Token keyword, 1068 Token keyword,
992 TypeAnnotation type, 1069 TypeAnnotation type,
993 List<VariableDeclaration> variables); 1070 List<VariableDeclaration> variables);
994 1071
995 /** 1072 /**
996 * Returns a newly created generic type alias. Either or both of the
997 * [comment] and [metadata] can be `null` if the variable list does not have
998 * the corresponding attribute. The [typeParameters] can be `null` if there
999 * are no type parameters.
1000 */
1001 GenericTypeAlias genericTypeAlias(Comment comment, List<Annotation> metadata, Token typedefKeyword, SimpleIdentifier name, TypeParameterList typeParameters, T oken equals, GenericFunctionType functionType, Token semicolon);
1002
1003 /**
1004 * Initialize a newly created generic function type.
1005 */
1006 GenericFunctionType genericFunctionType(TypeAnnotation returnType, Token funct ionKeyword, TypeParameterList typeParameters, FormalParameterList _parameters);
1007
1008 /**
1009 * Returns a newly created variable declaration statement. 1073 * Returns a newly created variable declaration statement.
1010 */ 1074 */
1011 VariableDeclarationStatement variableDeclarationStatement( 1075 VariableDeclarationStatement variableDeclarationStatement(
1012 VariableDeclarationList variableList, Token semicolon); 1076 VariableDeclarationList variableList, Token semicolon);
1013 1077
1014 /** 1078 /**
1015 * Returns a newly created while statement. 1079 * Returns a newly created while statement.
1016 */ 1080 */
1017 WhileStatement whileStatement(Token whileKeyword, Token leftParenthesis, 1081 WhileStatement whileStatement(Token whileKeyword, Token leftParenthesis,
1018 Expression condition, Token rightParenthesis, Statement body); 1082 Expression condition, Token rightParenthesis, Statement body);
1019 1083
1020 /** 1084 /**
1021 * Returns a newly created with clause. 1085 * Returns a newly created with clause.
1022 */ 1086 */
1023 WithClause withClause(Token withKeyword, List<TypeName> mixinTypes); 1087 WithClause withClause(Token withKeyword, List<TypeName> mixinTypes);
1024 1088
1025 /** 1089 /**
1026 * Returns a newly created yield expression. The [star] can be `null` if no 1090 * Returns a newly created yield expression. The [star] can be `null` if no
1027 * star was provided. 1091 * star was provided.
1028 */ 1092 */
1029 YieldStatement yieldStatement( 1093 YieldStatement yieldStatement(
1030 Token yieldKeyword, Token star, Expression expression, Token semicolon); 1094 Token yieldKeyword, Token star, Expression expression, Token semicolon);
1031 } 1095 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/dart/ast/ast.dart ('k') | pkg/analyzer/lib/src/dart/ast/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698