OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'package:analyzer/dart/ast/ast.dart'; | |
6 import 'package:analyzer/dart/ast/comment_type.dart'; | |
7 import 'package:analyzer/src/generated/utilities_dart.dart'; | |
8 import 'package:front_end/src/scanner/token.dart'; | |
9 | |
10 /** | |
11 * A collection of factory methods which may be used to create concrete | |
12 * instances of the interfaces that constitute the AST. | |
Brian Wilkerson
2016/11/23 15:58:18
Clients should not be allowed to extend, implement
Paul Berry
2016/11/24 15:03:17
Done.
| |
13 */ | |
14 abstract class AstFactory { | |
15 /** | |
16 * Initialize a newly created list of adjacent strings. To be syntactically | |
Brian Wilkerson
2016/11/23 15:58:18
Perhaps "Initialize" --> "Return"? I uniformly use
Paul Berry
2016/11/24 15:03:17
Done. Changed to "Returns" to be consistent with
| |
17 * valid, the list of [strings] must contain at least two elements. | |
18 */ | |
19 AdjacentStrings adjacentStrings(List<StringLiteral> strings); | |
20 | |
21 /** | |
22 * Initialize a newly created annotation. Both the [period] and the | |
23 * [constructorName] can be `null` if the annotation is not referencing a | |
24 * named constructor. The [arguments] can be `null` if the annotation is not | |
25 * referencing a constructor. | |
26 */ | |
27 Annotation annotation(Token atSign, Identifier name, Token period, | |
28 SimpleIdentifier constructorName, ArgumentList arguments); | |
29 | |
30 /** | |
31 * Initialize a newly created list of arguments. The list of [arguments] can | |
32 * be `null` if there are no arguments. | |
33 */ | |
34 ArgumentList argumentList(Token leftParenthesis, List<Expression> arguments, | |
35 Token rightParenthesis); | |
36 | |
37 /** | |
38 * Initialize a newly created as expression. | |
39 */ | |
40 AsExpression asExpression( | |
41 Expression expression, Token asOperator, TypeName type); | |
42 | |
43 /** | |
44 * Initialize a newly created assert initializer. The [comma] and [message] | |
45 * can be `null` if there is no message. | |
46 */ | |
47 AssertInitializer assertInitializer( | |
48 Token assertKeyword, | |
49 Token leftParenthesis, | |
50 Expression condition, | |
51 Token comma, | |
52 Expression message, | |
53 Token rightParenthesis); | |
54 | |
55 /** | |
56 * Initialize a newly created assert statement. The [comma] and [message] can | |
57 * be `null` if there is no message. | |
58 */ | |
59 AssertStatement assertStatement( | |
60 Token assertKeyword, | |
61 Token leftParenthesis, | |
62 Expression condition, | |
63 Token comma, | |
64 Expression message, | |
65 Token rightParenthesis, | |
66 Token semicolon); | |
67 | |
68 /** | |
69 * Initialize a newly created assignment expression. | |
70 */ | |
71 AssignmentExpression assignmentExpression( | |
72 Expression leftHandSide, Token operator, Expression rightHandSide); | |
73 | |
74 /** | |
75 * Initialize a newly created await expression. | |
76 */ | |
77 AwaitExpression awaitExpression(Token awaitKeyword, Expression expression); | |
78 | |
79 /** | |
80 * Initialize a newly created binary expression. | |
81 */ | |
82 BinaryExpression binaryExpression( | |
83 Expression leftOperand, Token operator, Expression rightOperand); | |
84 /** | |
85 * Initialize a newly created block of code. | |
86 */ | |
87 Block block( | |
88 Token leftBracket, List<Statement> statements, Token rightBracket); | |
89 | |
90 /** | |
91 * Initialize a newly created function body consisting of a block of | |
92 * statements. The [keyword] can be `null` if there is no keyword specified | |
93 * for the block. The [star] can be `null` if there is no star following the | |
94 * keyword (and must be `null` if there is no keyword). | |
95 */ | |
96 BlockFunctionBody blockFunctionBody(Token keyword, Token star, Block block); | |
97 | |
98 /** | |
99 * Initialize a newly created boolean literal. | |
100 */ | |
101 BooleanLiteral booleanLiteral(Token literal, bool value); | |
102 | |
103 /** | |
104 * Initialize a newly created break statement. The [label] can be `null` if | |
105 * there is no label associated with the statement. | |
106 */ | |
107 BreakStatement breakStatement( | |
108 Token breakKeyword, SimpleIdentifier label, Token semicolon); | |
109 | |
110 /** | |
111 * Initialize a newly created cascade expression. The list of | |
112 * [cascadeSections] must contain at least one element. | |
113 */ | |
114 CascadeExpression cascadeExpression( | |
115 Expression target, List<Expression> cascadeSections); | |
116 | |
117 /** | |
118 * Initialize a newly created catch clause. The [onKeyword] and | |
119 * [exceptionType] can be `null` if the clause will catch all exceptions. The | |
120 * [comma] and [stackTraceParameter] can be `null` if the stack trace | |
121 * parameter is not defined. | |
122 */ | |
123 CatchClause catchClause( | |
124 Token onKeyword, | |
125 TypeName exceptionType, | |
126 Token catchKeyword, | |
127 Token leftParenthesis, | |
128 SimpleIdentifier exceptionParameter, | |
129 Token comma, | |
130 SimpleIdentifier stackTraceParameter, | |
131 Token rightParenthesis, | |
132 Block body); | |
133 | |
134 /** | |
135 * Initialize a newly created class declaration. Either or both of the | |
136 * [comment] and [metadata] can be `null` if the class does not have the | |
137 * corresponding attribute. The [abstractKeyword] can be `null` if the class | |
138 * is not abstract. The [typeParameters] can be `null` if the class does not | |
139 * have any type parameters. Any or all of the [extendsClause], [withClause], | |
140 * and [implementsClause] can be `null` if the class does not have the | |
141 * corresponding clause. The list of [members] can be `null` if the class does | |
142 * not have any members. | |
143 */ | |
144 ClassDeclaration classDeclaration( | |
145 Comment comment, | |
146 List<Annotation> metadata, | |
147 Token abstractKeyword, | |
148 Token classKeyword, | |
149 SimpleIdentifier name, | |
150 TypeParameterList typeParameters, | |
151 ExtendsClause extendsClause, | |
152 WithClause withClause, | |
153 ImplementsClause implementsClause, | |
154 Token leftBracket, | |
155 List<ClassMember> members, | |
156 Token rightBracket); | |
157 | |
158 /** | |
159 * Initialize a newly created class type alias. Either or both of the | |
160 * [comment] and [metadata] can be `null` if the class type alias does not | |
161 * have the corresponding attribute. The [typeParameters] can be `null` if the | |
162 * class does not have any type parameters. The [abstractKeyword] can be | |
163 * `null` if the class is not abstract. The [implementsClause] can be `null` | |
164 * if the class does not implement any interfaces. | |
165 */ | |
166 ClassTypeAlias classTypeAlias( | |
167 Comment comment, | |
168 List<Annotation> metadata, | |
169 Token keyword, | |
170 SimpleIdentifier name, | |
171 TypeParameterList typeParameters, | |
172 Token equals, | |
173 Token abstractKeyword, | |
174 TypeName superclass, | |
175 WithClause withClause, | |
176 ImplementsClause implementsClause, | |
177 Token semicolon); | |
178 | |
179 /** | |
180 * Initialize a newly created comment. The list of [tokens] must contain at | |
181 * least one token. The [type] is the type of the comment. The list of | |
182 * [references] can be empty if the comment does not contain any embedded | |
183 * references. | |
184 */ | |
185 Comment comment( | |
186 List<Token> tokens, CommentType type, List<CommentReference> references); | |
Brian Wilkerson
2016/11/23 15:58:18
This method should be removed in favor of the more
Paul Berry
2016/11/24 15:03:17
Done.
| |
187 | |
188 /** | |
189 * Initialize a newly created reference to a Dart element. The [newKeyword] | |
190 * can be `null` if the reference is not to a constructor. | |
191 */ | |
192 CommentReference commentReference(Token newKeyword, Identifier identifier); | |
193 | |
194 /** | |
195 * Initialize a newly created compilation unit to have the given directives | |
196 * and declarations. The [scriptTag] can be `null` if there is no script tag | |
197 * in the compilation unit. The list of [directives] can be `null` if there | |
198 * are no directives in the compilation unit. The list of [declarations] can | |
199 * be `null` if there are no declarations in the compilation unit. | |
200 */ | |
201 CompilationUnit compilationUnit( | |
202 Token beginToken, | |
203 ScriptTag scriptTag, | |
204 List<Directive> directives, | |
205 List<CompilationUnitMember> declarations, | |
206 Token endToken); | |
207 | |
208 /** | |
209 * Initialize a newly created conditional expression. | |
210 */ | |
211 ConditionalExpression conditionalExpression( | |
212 Expression condition, | |
213 Token question, | |
214 Expression thenExpression, | |
215 Token colon, | |
216 Expression elseExpression); | |
217 | |
218 /** | |
219 * Initialize a newly created configuration. | |
220 */ | |
221 Configuration configuration( | |
222 Token ifKeyword, | |
223 Token leftParenthesis, | |
224 DottedName name, | |
225 Token equalToken, | |
226 StringLiteral value, | |
227 Token rightParenthesis, | |
228 StringLiteral libraryUri); | |
229 | |
230 /** | |
231 * Initialize a newly created constructor declaration. The [externalKeyword] | |
232 * can be `null` if the constructor is not external. Either or both of the | |
233 * [comment] and [metadata] can be `null` if the constructor does not have the | |
234 * corresponding attribute. The [constKeyword] can be `null` if the | |
235 * constructor cannot be used to create a constant. The [factoryKeyword] can | |
236 * be `null` if the constructor is not a factory. The [period] and [name] can | |
237 * both be `null` if the constructor is not a named constructor. The | |
238 * [separator] can be `null` if the constructor does not have any initializers | |
239 * and does not redirect to a different constructor. The list of | |
240 * [initializers] can be `null` if the constructor does not have any | |
241 * initializers. The [redirectedConstructor] can be `null` if the constructor | |
242 * does not redirect to a different constructor. The [body] can be `null` if | |
243 * the constructor does not have a body. | |
244 */ | |
245 ConstructorDeclaration constructorDeclaration( | |
246 Comment comment, | |
247 List<Annotation> metadata, | |
248 Token externalKeyword, | |
249 Token constKeyword, | |
250 Token factoryKeyword, | |
251 Identifier returnType, | |
252 Token period, | |
253 SimpleIdentifier name, | |
254 FormalParameterList parameters, | |
255 Token separator, | |
256 List<ConstructorInitializer> initializers, | |
257 ConstructorName redirectedConstructor, | |
258 FunctionBody body); | |
259 | |
260 /** | |
261 * Initialize a newly created field initializer to initialize the field with | |
262 * the given name to the value of the given expression. The [thisKeyword] and | |
263 * [period] can be `null` if the 'this' keyword was not specified. | |
264 */ | |
265 ConstructorFieldInitializer constructorFieldInitializer( | |
266 Token thisKeyword, | |
267 Token period, | |
268 SimpleIdentifier fieldName, | |
269 Token equals, | |
270 Expression expression); | |
271 | |
272 /** | |
273 * Initialize a newly created constructor name. The [period] and [name] can be | |
274 * `null` if the constructor being named is the unnamed constructor. | |
275 */ | |
276 ConstructorName constructorName( | |
277 TypeName type, Token period, SimpleIdentifier name); | |
278 | |
279 /** | |
280 * Initialize a newly created continue statement. The [label] can be `null` if | |
281 * there is no label associated with the statement. | |
282 */ | |
283 ContinueStatement continueStatement( | |
284 Token continueKeyword, SimpleIdentifier label, Token semicolon); | |
285 | |
286 /** | |
287 * Create a block comment consisting of the given [tokens]. | |
288 */ | |
289 Comment createBlockComment(List<Token> tokens); | |
Brian Wilkerson
2016/11/23 15:58:18
This and the other "create" methods should have "c
Paul Berry
2016/11/24 15:03:17
Done.
| |
290 | |
291 /** | |
292 * Create a documentation comment consisting of the given [tokens]. | |
293 */ | |
294 Comment createDocumentationComment(List<Token> tokens); | |
295 | |
296 /** | |
297 * Create a documentation comment consisting of the given [tokens] and having | |
298 * the given [references] embedded within it. | |
299 */ | |
300 Comment createDocumentationCommentWithReferences( | |
Brian Wilkerson
2016/11/23 15:58:18
We should remove this method and add an optional '
Paul Berry
2016/11/24 15:03:17
Done.
| |
301 List<Token> tokens, List<CommentReference> references); | |
302 | |
303 /** | |
304 * Create an end-of-line comment consisting of the given [tokens]. | |
305 */ | |
306 Comment createEndOfLineComment(List<Token> tokens); | |
307 | |
308 /** | |
309 * Initialize a newly created formal parameter. Either or both of the | |
310 * [comment] and [metadata] can be `null` if the declaration does not have the | |
311 * corresponding attribute. The [keyword] can be `null` if a type name is | |
312 * given. The [type] must be `null` if the keyword is 'var'. | |
313 */ | |
314 DeclaredIdentifier declaredIdentifier( | |
315 Comment comment, | |
316 List<Annotation> metadata, | |
317 Token keyword, | |
318 TypeName type, | |
319 SimpleIdentifier identifier); | |
320 | |
321 /** | |
322 * Initialize a newly created default formal parameter. The [separator] and | |
323 * [defaultValue] can be `null` if there is no default value. | |
324 */ | |
325 DefaultFormalParameter defaultFormalParameter(NormalFormalParameter parameter, | |
326 ParameterKind kind, Token separator, Expression defaultValue); | |
327 | |
328 /** | |
329 * Initialize a newly created do loop. | |
330 */ | |
331 DoStatement doStatement( | |
332 Token doKeyword, | |
333 Statement body, | |
334 Token whileKeyword, | |
335 Token leftParenthesis, | |
336 Expression condition, | |
337 Token rightParenthesis, | |
338 Token semicolon); | |
339 | |
340 /** | |
341 * Initialize a newly created dotted name. | |
342 */ | |
343 DottedName dottedName(List<SimpleIdentifier> components); | |
344 | |
345 /** | |
346 * Initialize a newly created floating point literal. | |
347 */ | |
348 DoubleLiteral doubleLiteral(Token literal, double value); | |
349 | |
350 /** | |
351 * Initialize a newly created function body. | |
352 */ | |
353 EmptyFunctionBody emptyFunctionBody(Token semicolon); | |
354 | |
355 /** | |
356 * Initialize a newly created empty statement. | |
357 */ | |
358 EmptyStatement emptyStatement(Token semicolon); | |
359 | |
360 /** | |
361 * Initialize a newly created enum constant declaration. Either or both of the | |
362 * [comment] and [metadata] can be `null` if the constant does not have the | |
363 * corresponding attribute. (Technically, enum constants cannot have metadata, | |
364 * but we allow it for consistency.) | |
365 */ | |
366 EnumConstantDeclaration enumConstantDeclaration( | |
367 Comment comment, List<Annotation> metadata, SimpleIdentifier name); | |
368 | |
369 /** | |
370 * Initialize a newly created enumeration declaration. Either or both of the | |
371 * [comment] and [metadata] can be `null` if the declaration does not have the | |
372 * corresponding attribute. The list of [constants] must contain at least one | |
373 * value. | |
374 */ | |
375 EnumDeclaration enumDeclaration( | |
376 Comment comment, | |
377 List<Annotation> metadata, | |
378 Token enumKeyword, | |
379 SimpleIdentifier name, | |
380 Token leftBracket, | |
381 List<EnumConstantDeclaration> constants, | |
382 Token rightBracket); | |
383 | |
384 /** | |
385 * Initialize a newly created export directive. Either or both of the | |
386 * [comment] and [metadata] can be `null` if the directive does not have the | |
387 * corresponding attribute. The list of [combinators] can be `null` if there | |
388 * are no combinators. | |
389 */ | |
390 ExportDirective exportDirective( | |
391 Comment comment, | |
392 List<Annotation> metadata, | |
393 Token keyword, | |
394 StringLiteral libraryUri, | |
395 List<Configuration> configurations, | |
396 List<Combinator> combinators, | |
397 Token semicolon); | |
398 /** | |
399 * Initialize a newly created function body consisting of a block of | |
400 * statements. The [keyword] can be `null` if the function body is not an | |
401 * async function body. | |
402 */ | |
403 ExpressionFunctionBody expressionFunctionBody(Token keyword, | |
404 Token functionDefinition, Expression expression, Token semicolon); | |
405 | |
406 /** | |
407 * Initialize a newly created expression statement. | |
408 */ | |
409 ExpressionStatement expressionStatement( | |
410 Expression expression, Token semicolon); | |
411 | |
412 /** | |
413 * Initialize a newly created extends clause. | |
414 */ | |
415 ExtendsClause extendsClause(Token extendsKeyword, TypeName superclass); | |
416 | |
417 /** | |
418 * Initialize a newly created field declaration. Either or both of the | |
419 * [comment] and [metadata] can be `null` if the declaration does not have the | |
420 * corresponding attribute. The [staticKeyword] can be `null` if the field is | |
421 * not a static field. | |
422 */ | |
423 FieldDeclaration fieldDeclaration(Comment comment, List<Annotation> metadata, | |
424 Token staticKeyword, VariableDeclarationList fieldList, Token semicolon); | |
425 | |
426 /** | |
427 * Initialize a newly created formal parameter. Either or both of the | |
428 * [comment] and [metadata] can be `null` if the parameter does not have the | |
429 * corresponding attribute. The [keyword] can be `null` if there is a type. | |
430 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and | |
431 * [period] can be `null` if the keyword 'this' was not provided. The | |
432 * [parameters] can be `null` if this is not a function-typed field formal | |
433 * parameter. | |
434 */ | |
435 FieldFormalParameter fieldFormalParameter( | |
436 Comment comment, | |
437 List<Annotation> metadata, | |
438 Token keyword, | |
439 TypeName type, | |
440 Token thisKeyword, | |
441 Token period, | |
442 SimpleIdentifier identifier, | |
443 TypeParameterList typeParameters, | |
444 FormalParameterList parameters); | |
445 | |
446 /** | |
447 * Initialize a newly created for-each statement whose loop control variable | |
448 * is declared internally (in the for-loop part). The [awaitKeyword] can be | |
449 * `null` if this is not an asynchronous for loop. | |
450 */ | |
451 ForEachStatement forEachStatementWithDeclaration( | |
452 Token awaitKeyword, | |
453 Token forKeyword, | |
454 Token leftParenthesis, | |
455 DeclaredIdentifier loopVariable, | |
456 Token inKeyword, | |
457 Expression iterator, | |
458 Token rightParenthesis, | |
459 Statement body); | |
460 | |
461 /** | |
462 * Initialize a newly created for-each statement whose loop control variable | |
463 * is declared outside the for loop. The [awaitKeyword] can be `null` if this | |
464 * is not an asynchronous for loop. | |
465 */ | |
466 ForEachStatement forEachStatementWithReference( | |
467 Token awaitKeyword, | |
468 Token forKeyword, | |
469 Token leftParenthesis, | |
470 SimpleIdentifier identifier, | |
471 Token inKeyword, | |
472 Expression iterator, | |
473 Token rightParenthesis, | |
474 Statement body); | |
475 | |
476 /** | |
477 * Initialize a newly created parameter list. The list of [parameters] can be | |
478 * `null` if there are no parameters. The [leftDelimiter] and [rightDelimiter] | |
479 * can be `null` if there are no optional parameters. | |
480 */ | |
481 FormalParameterList formalParameterList( | |
482 Token leftParenthesis, | |
483 List<FormalParameter> parameters, | |
484 Token leftDelimiter, | |
485 Token rightDelimiter, | |
486 Token rightParenthesis); | |
487 | |
488 /** | |
489 * Initialize a newly created for statement. Either the [variableList] or the | |
490 * [initialization] must be `null`. Either the [condition] and the list of | |
491 * [updaters] can be `null` if the loop does not have the corresponding | |
492 * attribute. | |
493 */ | |
494 ForStatement forStatement( | |
495 Token forKeyword, | |
496 Token leftParenthesis, | |
497 VariableDeclarationList variableList, | |
498 Expression initialization, | |
499 Token leftSeparator, | |
500 Expression condition, | |
501 Token rightSeparator, | |
502 List<Expression> updaters, | |
503 Token rightParenthesis, | |
504 Statement body); | |
505 | |
506 /** | |
507 * Initialize a newly created function declaration. Either or both of the | |
508 * [comment] and [metadata] can be `null` if the function does not have the | |
509 * corresponding attribute. The [externalKeyword] can be `null` if the | |
510 * function is not an external function. The [returnType] can be `null` if no | |
511 * return type was specified. The [propertyKeyword] can be `null` if the | |
512 * function is neither a getter or a setter. | |
513 */ | |
514 FunctionDeclaration functionDeclaration( | |
515 Comment comment, | |
516 List<Annotation> metadata, | |
517 Token externalKeyword, | |
518 TypeName returnType, | |
519 Token propertyKeyword, | |
520 SimpleIdentifier name, | |
521 FunctionExpression functionExpression); | |
522 | |
523 /** | |
524 * Initialize a newly created function declaration statement. | |
525 */ | |
526 FunctionDeclarationStatement functionDeclarationStatement( | |
527 FunctionDeclaration functionDeclaration); | |
528 | |
529 /** | |
530 * Initialize a newly created function declaration. | |
531 */ | |
532 FunctionExpression functionExpression(TypeParameterList typeParameters, | |
533 FormalParameterList parameters, FunctionBody body); | |
534 | |
535 /** | |
536 * Initialize a newly created function expression invocation. | |
537 */ | |
538 FunctionExpressionInvocation functionExpressionInvocation(Expression function, | |
539 TypeArgumentList typeArguments, ArgumentList argumentList); | |
540 | |
541 /** | |
542 * Initialize a newly created function type alias. Either or both of the | |
543 * [comment] and [metadata] can be `null` if the function does not have the | |
544 * corresponding attribute. The [returnType] can be `null` if no return type | |
545 * was specified. The [typeParameters] can be `null` if the function has no | |
546 * type parameters. | |
547 */ | |
548 FunctionTypeAlias functionTypeAlias( | |
549 Comment comment, | |
550 List<Annotation> metadata, | |
551 Token keyword, | |
552 TypeName returnType, | |
553 SimpleIdentifier name, | |
554 TypeParameterList typeParameters, | |
555 FormalParameterList parameters, | |
556 Token semicolon); | |
557 | |
558 /** | |
559 * Initialize a newly created formal parameter. Either or both of the | |
560 * [comment] and [metadata] can be `null` if the parameter does not have the | |
561 * corresponding attribute. The [returnType] can be `null` if no return type | |
562 * was specified. | |
563 */ | |
564 FunctionTypedFormalParameter functionTypedFormalParameter( | |
565 Comment comment, | |
566 List<Annotation> metadata, | |
567 TypeName returnType, | |
568 SimpleIdentifier identifier, | |
569 TypeParameterList typeParameters, | |
570 FormalParameterList parameters, | |
571 {Token question: null}); | |
572 | |
573 /** | |
574 * Initialize a newly created import show combinator. | |
575 */ | |
576 HideCombinator hideCombinator( | |
577 Token keyword, List<SimpleIdentifier> hiddenNames); | |
578 | |
579 /** | |
580 * Initialize a newly created if statement. The [elseKeyword] and | |
581 * [elseStatement] can be `null` if there is no else clause. | |
582 */ | |
583 IfStatement ifStatement( | |
584 Token ifKeyword, | |
585 Token leftParenthesis, | |
586 Expression condition, | |
587 Token rightParenthesis, | |
588 Statement thenStatement, | |
589 Token elseKeyword, | |
590 Statement elseStatement); | |
591 | |
592 /** | |
593 * Initialize a newly created implements clause. | |
594 */ | |
595 ImplementsClause implementsClause( | |
596 Token implementsKeyword, List<TypeName> interfaces); | |
597 | |
598 /** | |
599 * Initialize a newly created import directive. Either or both of the | |
600 * [comment] and [metadata] can be `null` if the function does not have the | |
601 * corresponding attribute. The [deferredKeyword] can be `null` if the import | |
602 * is not deferred. The [asKeyword] and [prefix] can be `null` if the import | |
603 * does not specify a prefix. The list of [combinators] can be `null` if there | |
604 * are no combinators. | |
605 */ | |
606 ImportDirective importDirective( | |
607 Comment comment, | |
608 List<Annotation> metadata, | |
609 Token keyword, | |
610 StringLiteral libraryUri, | |
611 List<Configuration> configurations, | |
612 Token deferredKeyword, | |
613 Token asKeyword, | |
614 SimpleIdentifier prefix, | |
615 List<Combinator> combinators, | |
616 Token semicolon); | |
617 | |
618 /** | |
619 * Initialize a newly created index expression. | |
620 */ | |
621 IndexExpression indexExpressionForCascade( | |
622 Token period, Token leftBracket, Expression index, Token rightBracket); | |
623 | |
624 /** | |
625 * Initialize a newly created index expression. | |
626 */ | |
627 IndexExpression indexExpressionForTarget(Expression target, Token leftBracket, | |
628 Expression index, Token rightBracket); | |
629 | |
630 /** | |
631 * Initialize a newly created instance creation expression. | |
632 */ | |
633 InstanceCreationExpression instanceCreationExpression(Token keyword, | |
634 ConstructorName constructorName, ArgumentList argumentList); | |
635 | |
636 /** | |
637 * Initialize a newly created integer literal. | |
638 */ | |
639 IntegerLiteral integerLiteral(Token literal, int value); | |
640 | |
641 /** | |
642 * Initialize a newly created interpolation expression. | |
643 */ | |
644 InterpolationExpression interpolationExpression( | |
645 Token leftBracket, Expression expression, Token rightBracket); | |
646 | |
647 /** | |
648 * Initialize a newly created string of characters that are part of a string | |
649 * interpolation. | |
650 */ | |
651 InterpolationString interpolationString(Token contents, String value); | |
652 | |
653 /** | |
654 * Initialize a newly created is expression. The [notOperator] can be `null` | |
655 * if the sense of the test is not negated. | |
656 */ | |
657 IsExpression isExpression(Expression expression, Token isOperator, | |
658 Token notOperator, TypeName type); | |
659 | |
660 /** | |
661 * Initialize a newly created label. | |
662 */ | |
663 Label label(SimpleIdentifier label, Token colon); | |
664 | |
665 /** | |
666 * Initialize a newly created labeled statement. | |
667 */ | |
668 LabeledStatement labeledStatement(List<Label> labels, Statement statement); | |
669 | |
670 /** | |
671 * Initialize a newly created library directive. Either or both of the | |
672 * [comment] and [metadata] can be `null` if the directive does not have the | |
673 * corresponding attribute. | |
674 */ | |
675 LibraryDirective libraryDirective(Comment comment, List<Annotation> metadata, | |
676 Token libraryKeyword, LibraryIdentifier name, Token semicolon); | |
677 | |
678 /** | |
679 * Initialize a newly created prefixed identifier. | |
680 */ | |
681 LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components); | |
682 | |
683 /** | |
684 * Initialize a newly created list literal. The [constKeyword] can be `null` | |
685 * if the literal is not a constant. The [typeArguments] can be `null` if no | |
686 * type arguments were declared. The list of [elements] can be `null` if the | |
687 * list is empty. | |
688 */ | |
689 ListLiteral listLiteral(Token constKeyword, TypeArgumentList typeArguments, | |
690 Token leftBracket, List<Expression> elements, Token rightBracket); | |
691 | |
692 /** | |
693 * Initialize a newly created map literal. The [constKeyword] can be `null` if | |
694 * the literal is not a constant. The [typeArguments] can be `null` if no type | |
695 * arguments were declared. The [entries] can be `null` if the map is empty. | |
696 */ | |
697 MapLiteral mapLiteral(Token constKeyword, TypeArgumentList typeArguments, | |
698 Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket); | |
699 | |
700 /** | |
701 * Initialize a newly created map literal entry. | |
702 */ | |
703 MapLiteralEntry mapLiteralEntry( | |
704 Expression key, Token separator, Expression value); | |
705 | |
706 /** | |
707 * Initialize a newly created method declaration. Either or both of the | |
708 * [comment] and [metadata] can be `null` if the declaration does not have the | |
709 * corresponding attribute. The [externalKeyword] can be `null` if the method | |
710 * is not external. The [modifierKeyword] can be `null` if the method is | |
711 * neither abstract nor static. The [returnType] can be `null` if no return | |
712 * type was specified. The [propertyKeyword] can be `null` if the method is | |
713 * neither a getter or a setter. The [operatorKeyword] can be `null` if the | |
714 * method does not implement an operator. The [parameters] must be `null` if | |
715 * this method declares a getter. | |
716 */ | |
717 MethodDeclaration methodDeclaration( | |
718 Comment comment, | |
719 List<Annotation> metadata, | |
720 Token externalKeyword, | |
721 Token modifierKeyword, | |
722 TypeName returnType, | |
723 Token propertyKeyword, | |
724 Token operatorKeyword, | |
725 SimpleIdentifier name, | |
726 TypeParameterList typeParameters, | |
727 FormalParameterList parameters, | |
728 FunctionBody body); | |
729 | |
730 /** | |
731 * Initialize a newly created method invocation. The [target] and [operator] | |
732 * can be `null` if there is no target. | |
733 */ | |
734 MethodInvocation methodInvocation( | |
735 Expression target, | |
736 Token operator, | |
737 SimpleIdentifier methodName, | |
738 TypeArgumentList typeArguments, | |
739 ArgumentList argumentList); | |
740 | |
741 /** | |
742 * Initialize a newly created named expression.. | |
743 */ | |
744 NamedExpression namedExpression(Label name, Expression expression); | |
745 | |
746 /** | |
747 * Initialize a newly created native clause. | |
748 */ | |
749 NativeClause nativeClause(Token nativeKeyword, StringLiteral name); | |
750 | |
751 /** | |
752 * Initialize a newly created function body consisting of the 'native' token, | |
753 * a string literal, and a semicolon. | |
754 */ | |
755 NativeFunctionBody nativeFunctionBody( | |
756 Token nativeKeyword, StringLiteral stringLiteral, Token semicolon); | |
757 | |
758 /** | |
759 * Initialize a newly created list of nodes such that all of the nodes that | |
760 * are added to the list will have their parent set to the given [owner]. The | |
761 * list will initially be populated with the given [elements]. | |
762 */ | |
763 NodeList/*<E>*/ nodeList/*<E extends AstNode>*/(AstNode owner, | |
764 [List/*<E>*/ elements]); | |
765 | |
766 /** | |
767 * Initialize a newly created null literal. | |
768 */ | |
769 NullLiteral nullLiteral(Token literal); | |
770 | |
771 /** | |
772 * Initialize a newly created parenthesized expression. | |
773 */ | |
774 ParenthesizedExpression parenthesizedExpression( | |
775 Token leftParenthesis, Expression expression, Token rightParenthesis); | |
776 | |
777 /** | |
778 * Initialize a newly created part directive. Either or both of the [comment] | |
779 * and [metadata] can be `null` if the directive does not have the | |
780 * corresponding attribute. | |
781 */ | |
782 PartDirective partDirective(Comment comment, List<Annotation> metadata, | |
783 Token partKeyword, StringLiteral partUri, Token semicolon); | |
784 | |
785 /** | |
786 * Initialize a newly created part-of directive. Either or both of the | |
787 * [comment] and [metadata] can be `null` if the directive does not have the | |
788 * corresponding attribute. | |
789 */ | |
790 PartOfDirective partOfDirective( | |
791 Comment comment, | |
792 List<Annotation> metadata, | |
793 Token partKeyword, | |
794 Token ofKeyword, | |
795 LibraryIdentifier libraryName, | |
796 Token semicolon); | |
797 | |
798 /** | |
799 * Initialize a newly created postfix expression. | |
800 */ | |
801 PostfixExpression postfixExpression(Expression operand, Token operator); | |
802 | |
803 /** | |
804 * Initialize a newly created prefixed identifier. | |
805 */ | |
806 PrefixedIdentifier prefixedIdentifier( | |
807 SimpleIdentifier prefix, Token period, SimpleIdentifier identifier); | |
808 | |
809 /** | |
810 * Initialize a newly created prefix expression. | |
811 */ | |
812 PrefixExpression prefixExpression(Token operator, Expression operand); | |
813 | |
814 /** | |
815 * Initialize a newly created property access expression. | |
816 */ | |
817 PropertyAccess propertyAccess( | |
818 Expression target, Token operator, SimpleIdentifier propertyName); | |
819 | |
820 /** | |
821 * Initialize a newly created redirecting invocation to invoke the constructor | |
822 * with the given name with the given arguments. The [constructorName] can be | |
823 * `null` if the constructor being invoked is the unnamed constructor. | |
824 */ | |
825 RedirectingConstructorInvocation redirectingConstructorInvocation( | |
826 Token thisKeyword, | |
827 Token period, | |
828 SimpleIdentifier constructorName, | |
829 ArgumentList argumentList); | |
830 | |
831 /** | |
832 * Initialize a newly created rethrow expression. | |
833 */ | |
834 RethrowExpression rethrowExpression(Token rethrowKeyword); | |
835 | |
836 /** | |
837 * Initialize a newly created return statement. The [expression] can be `null` | |
838 * if no explicit value was provided. | |
839 */ | |
840 ReturnStatement returnStatement( | |
841 Token returnKeyword, Expression expression, Token semicolon); | |
842 | |
843 /** | |
844 * Initialize a newly created script tag. | |
845 */ | |
846 ScriptTag scriptTag(Token scriptTag); | |
847 | |
848 /** | |
849 * Initialize a newly created import show combinator. | |
850 */ | |
851 ShowCombinator showCombinator( | |
852 Token keyword, List<SimpleIdentifier> shownNames); | |
853 | |
854 /** | |
855 * Initialize a newly created formal parameter. Either or both of the | |
856 * [comment] and [metadata] can be `null` if the parameter does not have the | |
857 * corresponding attribute. The [keyword] can be `null` if a type was | |
858 * specified. The [type] must be `null` if the keyword is 'var'. | |
859 */ | |
860 SimpleFormalParameter simpleFormalParameter( | |
861 Comment comment, | |
862 List<Annotation> metadata, | |
863 Token keyword, | |
864 TypeName type, | |
865 SimpleIdentifier identifier); | |
866 | |
867 /** | |
868 * Initialize a newly created identifier. | |
869 */ | |
870 SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false}); | |
871 | |
872 /** | |
873 * Initialize a newly created simple string literal. | |
874 */ | |
875 SimpleStringLiteral simpleStringLiteral(Token literal, String value); | |
876 | |
877 /** | |
878 * Initialize a newly created string interpolation expression. | |
879 */ | |
880 StringInterpolation stringInterpolation(List<InterpolationElement> elements); | |
881 | |
882 /** | |
883 * Initialize a newly created super invocation to invoke the inherited | |
884 * constructor with the given name with the given arguments. The [period] and | |
885 * [constructorName] can be `null` if the constructor being invoked is the | |
886 * unnamed constructor. | |
887 */ | |
888 SuperConstructorInvocation superConstructorInvocation( | |
889 Token superKeyword, | |
890 Token period, | |
891 SimpleIdentifier constructorName, | |
892 ArgumentList argumentList); | |
893 | |
894 /** | |
895 * Initialize a newly created super expression. | |
896 */ | |
897 SuperExpression superExpression(Token superKeyword); | |
898 | |
899 /** | |
900 * Initialize a newly created switch case. The list of [labels] can be `null` | |
901 * if there are no labels. | |
902 */ | |
903 SwitchCase switchCase(List<Label> labels, Token keyword, | |
904 Expression expression, Token colon, List<Statement> statements); | |
905 | |
906 /** | |
907 * Initialize a newly created switch default. The list of [labels] can be | |
908 * `null` if there are no labels. | |
909 */ | |
910 SwitchDefault switchDefault(List<Label> labels, Token keyword, Token colon, | |
911 List<Statement> statements); | |
912 /** | |
913 * Initialize a newly created switch statement. The list of [members] can be | |
914 * `null` if there are no switch members. | |
915 */ | |
916 SwitchStatement switchStatement( | |
917 Token switchKeyword, | |
918 Token leftParenthesis, | |
919 Expression expression, | |
920 Token rightParenthesis, | |
921 Token leftBracket, | |
922 List<SwitchMember> members, | |
923 Token rightBracket); | |
924 | |
925 /** | |
926 * Initialize a newly created symbol literal. | |
927 */ | |
928 SymbolLiteral symbolLiteral(Token poundSign, List<Token> components); | |
929 | |
930 /** | |
931 * Initialize a newly created this expression. | |
932 */ | |
933 ThisExpression thisExpression(Token thisKeyword); | |
934 | |
935 /** | |
936 * Initialize a newly created throw expression. | |
937 */ | |
938 ThrowExpression throwExpression(Token throwKeyword, Expression expression); | |
939 | |
940 /** | |
941 * Initialize a newly created top-level variable declaration. Either or both | |
942 * of the [comment] and [metadata] can be `null` if the variable does not have | |
943 * the corresponding attribute. | |
944 */ | |
945 TopLevelVariableDeclaration topLevelVariableDeclaration( | |
946 Comment comment, | |
947 List<Annotation> metadata, | |
948 VariableDeclarationList variableList, | |
949 Token semicolon); | |
950 | |
951 /** | |
952 * Initialize a newly created try statement. The list of [catchClauses] can be | |
953 * `null` if there are no catch clauses. The [finallyKeyword] and | |
954 * [finallyBlock] can be `null` if there is no finally clause. | |
955 */ | |
956 TryStatement tryStatement(Token tryKeyword, Block body, | |
957 List<CatchClause> catchClauses, Token finallyKeyword, Block finallyBlock); | |
958 | |
959 /** | |
960 * Initialize a newly created list of type arguments. | |
961 */ | |
962 TypeArgumentList typeArgumentList( | |
963 Token leftBracket, List<TypeName> arguments, Token rightBracket); | |
964 | |
965 /** | |
966 * Initialize a newly created type name. The [typeArguments] can be `null` if | |
967 * there are no type arguments. | |
968 */ | |
969 TypeName typeName(Identifier name, TypeArgumentList typeArguments, | |
970 {Token question: null}); | |
971 | |
972 /** | |
973 * Initialize a newly created type parameter. Either or both of the [comment] | |
974 * and [metadata] can be `null` if the parameter does not have the | |
975 * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if | |
976 * the parameter does not have an upper bound. | |
977 */ | |
978 TypeParameter typeParameter(Comment comment, List<Annotation> metadata, | |
979 SimpleIdentifier name, Token extendsKeyword, TypeName bound); | |
980 | |
981 /** | |
982 * Initialize a newly created list of type parameters. | |
983 */ | |
984 TypeParameterList typeParameterList(Token leftBracket, | |
985 List<TypeParameter> typeParameters, Token rightBracket); | |
986 | |
987 /** | |
988 * Initialize a newly created variable declaration. The [equals] and | |
989 * [initializer] can be `null` if there is no initializer. | |
990 */ | |
991 VariableDeclaration variableDeclaration( | |
992 SimpleIdentifier name, Token equals, Expression initializer); | |
993 | |
994 /** | |
995 * Initialize a newly created variable declaration list. Either or both of the | |
996 * [comment] and [metadata] can be `null` if the variable list does not have | |
997 * the corresponding attribute. The [keyword] can be `null` if a type was | |
998 * specified. The [type] must be `null` if the keyword is 'var'. | |
999 */ | |
1000 VariableDeclarationList variableDeclarationList( | |
1001 Comment comment, | |
1002 List<Annotation> metadata, | |
1003 Token keyword, | |
1004 TypeName type, | |
1005 List<VariableDeclaration> variables); | |
1006 | |
1007 /** | |
1008 * Initialize a newly created variable declaration statement. | |
1009 */ | |
1010 VariableDeclarationStatement variableDeclarationStatement( | |
1011 VariableDeclarationList variableList, Token semicolon); | |
1012 | |
1013 /** | |
1014 * Initialize a newly created while statement. | |
1015 */ | |
1016 WhileStatement whileStatement(Token whileKeyword, Token leftParenthesis, | |
1017 Expression condition, Token rightParenthesis, Statement body); | |
1018 | |
1019 /** | |
1020 * Initialize a newly created with clause. | |
1021 */ | |
1022 WithClause withClause(Token withKeyword, List<TypeName> mixinTypes); | |
1023 | |
1024 /** | |
1025 * Initialize a newly created yield expression. The [star] can be `null` if no | |
1026 * star was provided. | |
1027 */ | |
1028 YieldStatement yieldStatement( | |
1029 Token yieldKeyword, Token star, Expression expression, Token semicolon); | |
1030 } | |
OLD | NEW |