OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 'dart:collection' show IterableMixin; | 5 import 'dart:collection' show IterableMixin; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../elements/elements.dart' show MetadataAnnotation; | 8 import '../elements/elements.dart' show MetadataAnnotation; |
9 import '../resolution/secret_tree_element.dart' | 9 import '../resolution/secret_tree_element.dart' |
10 show NullTreeElementMixin, StoredTreeElementMixin; | 10 show NullTreeElementMixin, StoredTreeElementMixin; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 R visitDoWhile(DoWhile node) => visitLoop(node); | 44 R visitDoWhile(DoWhile node) => visitLoop(node); |
45 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); | 45 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); |
46 R visitEnum(Enum node) => visitNode(node); | 46 R visitEnum(Enum node) => visitNode(node); |
47 R visitExport(Export node) => visitLibraryDependency(node); | 47 R visitExport(Export node) => visitLibraryDependency(node); |
48 R visitExpression(Expression node) => visitNode(node); | 48 R visitExpression(Expression node) => visitNode(node); |
49 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); | 49 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); |
50 R visitFor(For node) => visitLoop(node); | 50 R visitFor(For node) => visitLoop(node); |
51 R visitForIn(ForIn node) => visitLoop(node); | 51 R visitForIn(ForIn node) => visitLoop(node); |
52 R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node); | 52 R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node); |
53 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); | 53 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); |
54 R visitFunctionTypeAnnotation(FunctionTypeAnnotation node) { | |
55 return visitTypeAnnotation(node); | |
56 } | |
57 | |
58 R visitGotoStatement(GotoStatement node) => visitStatement(node); | 54 R visitGotoStatement(GotoStatement node) => visitStatement(node); |
59 R visitIdentifier(Identifier node) => visitExpression(node); | 55 R visitIdentifier(Identifier node) => visitExpression(node); |
60 R visitImport(Import node) => visitLibraryDependency(node); | 56 R visitImport(Import node) => visitLibraryDependency(node); |
61 R visitIf(If node) => visitStatement(node); | 57 R visitIf(If node) => visitStatement(node); |
62 R visitLabel(Label node) => visitNode(node); | 58 R visitLabel(Label node) => visitNode(node); |
63 R visitLabeledStatement(LabeledStatement node) => visitStatement(node); | 59 R visitLabeledStatement(LabeledStatement node) => visitStatement(node); |
64 R visitLibraryDependency(LibraryDependency node) => visitLibraryTag(node); | 60 R visitLibraryDependency(LibraryDependency node) => visitLibraryTag(node); |
65 R visitLibraryName(LibraryName node) => visitLibraryTag(node); | 61 R visitLibraryName(LibraryName node) => visitLibraryTag(node); |
66 R visitLibraryTag(LibraryTag node) => visitNode(node); | 62 R visitLibraryTag(LibraryTag node) => visitNode(node); |
67 R visitLiteral(Literal node) => visitExpression(node); | 63 R visitLiteral(Literal node) => visitExpression(node); |
(...skipping 11 matching lines...) Expand all Loading... |
79 R visitMetadata(Metadata node) => visitNode(node); | 75 R visitMetadata(Metadata node) => visitNode(node); |
80 R visitMixinApplication(MixinApplication node) => visitNode(node); | 76 R visitMixinApplication(MixinApplication node) => visitNode(node); |
81 R visitModifiers(Modifiers node) => visitNode(node); | 77 R visitModifiers(Modifiers node) => visitNode(node); |
82 R visitNamedArgument(NamedArgument node) => visitExpression(node); | 78 R visitNamedArgument(NamedArgument node) => visitExpression(node); |
83 R visitNamedMixinApplication(NamedMixinApplication node) { | 79 R visitNamedMixinApplication(NamedMixinApplication node) { |
84 return visitMixinApplication(node); | 80 return visitMixinApplication(node); |
85 } | 81 } |
86 | 82 |
87 R visitNewExpression(NewExpression node) => visitExpression(node); | 83 R visitNewExpression(NewExpression node) => visitExpression(node); |
88 R visitNodeList(NodeList node) => visitNode(node); | 84 R visitNodeList(NodeList node) => visitNode(node); |
89 R visitNominalTypeAnnotation(NominalTypeAnnotation node) { | |
90 return visitTypeAnnotation(node); | |
91 } | |
92 | |
93 R visitOperator(Operator node) => visitIdentifier(node); | 85 R visitOperator(Operator node) => visitIdentifier(node); |
94 R visitParenthesizedExpression(ParenthesizedExpression node) { | 86 R visitParenthesizedExpression(ParenthesizedExpression node) { |
95 return visitExpression(node); | 87 return visitExpression(node); |
96 } | 88 } |
97 | 89 |
98 R visitPart(Part node) => visitLibraryTag(node); | 90 R visitPart(Part node) => visitLibraryTag(node); |
99 R visitPartOf(PartOf node) => visitNode(node); | 91 R visitPartOf(PartOf node) => visitNode(node); |
100 R visitPostfix(Postfix node) => visitNodeList(node); | 92 R visitPostfix(Postfix node) => visitNodeList(node); |
101 R visitPrefix(Prefix node) => visitNodeList(node); | 93 R visitPrefix(Prefix node) => visitNodeList(node); |
102 R visitRedirectingFactoryBody(RedirectingFactoryBody node) { | 94 R visitRedirectingFactoryBody(RedirectingFactoryBody node) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 R visitFor(For node, A arg) => visitLoop(node, arg); | 172 R visitFor(For node, A arg) => visitLoop(node, arg); |
181 R visitForIn(ForIn node, A arg) => visitLoop(node, arg); | 173 R visitForIn(ForIn node, A arg) => visitLoop(node, arg); |
182 R visitFunctionDeclaration(FunctionDeclaration node, A arg) { | 174 R visitFunctionDeclaration(FunctionDeclaration node, A arg) { |
183 return visitStatement(node, arg); | 175 return visitStatement(node, arg); |
184 } | 176 } |
185 | 177 |
186 R visitFunctionExpression(FunctionExpression node, A arg) { | 178 R visitFunctionExpression(FunctionExpression node, A arg) { |
187 return visitExpression(node, arg); | 179 return visitExpression(node, arg); |
188 } | 180 } |
189 | 181 |
190 R visitFunctionTypeAnnotation(FunctionTypeAnnotation node, A arg) { | |
191 return visitTypeAnnotation(node, arg); | |
192 } | |
193 | |
194 R visitGotoStatement(GotoStatement node, A arg) { | 182 R visitGotoStatement(GotoStatement node, A arg) { |
195 return visitStatement(node, arg); | 183 return visitStatement(node, arg); |
196 } | 184 } |
197 | 185 |
198 R visitIdentifier(Identifier node, A arg) { | 186 R visitIdentifier(Identifier node, A arg) { |
199 return visitExpression(node, arg); | 187 return visitExpression(node, arg); |
200 } | 188 } |
201 | 189 |
202 R visitImport(Import node, A arg) { | 190 R visitImport(Import node, A arg) { |
203 return visitLibraryDependency(node, arg); | 191 return visitLibraryDependency(node, arg); |
(...skipping 29 matching lines...) Expand all Loading... |
233 R visitMetadata(Metadata node, A arg) => visitNode(node, arg); | 221 R visitMetadata(Metadata node, A arg) => visitNode(node, arg); |
234 R visitMixinApplication(MixinApplication node, A arg) => visitNode(node, arg); | 222 R visitMixinApplication(MixinApplication node, A arg) => visitNode(node, arg); |
235 R visitModifiers(Modifiers node, A arg) => visitNode(node, arg); | 223 R visitModifiers(Modifiers node, A arg) => visitNode(node, arg); |
236 R visitNamedArgument(NamedArgument node, A arg) => visitExpression(node, arg); | 224 R visitNamedArgument(NamedArgument node, A arg) => visitExpression(node, arg); |
237 R visitNamedMixinApplication(NamedMixinApplication node, A arg) { | 225 R visitNamedMixinApplication(NamedMixinApplication node, A arg) { |
238 return visitMixinApplication(node, arg); | 226 return visitMixinApplication(node, arg); |
239 } | 227 } |
240 | 228 |
241 R visitNewExpression(NewExpression node, A arg) => visitExpression(node, arg); | 229 R visitNewExpression(NewExpression node, A arg) => visitExpression(node, arg); |
242 R visitNodeList(NodeList node, A arg) => visitNode(node, arg); | 230 R visitNodeList(NodeList node, A arg) => visitNode(node, arg); |
243 R visitNominalTypeAnnotation(NominalTypeAnnotation node, A arg) { | |
244 visitTypeAnnotation(node, arg); | |
245 } | |
246 | |
247 R visitOperator(Operator node, A arg) => visitIdentifier(node, arg); | 231 R visitOperator(Operator node, A arg) => visitIdentifier(node, arg); |
248 R visitParenthesizedExpression(ParenthesizedExpression node, A arg) { | 232 R visitParenthesizedExpression(ParenthesizedExpression node, A arg) { |
249 return visitExpression(node, arg); | 233 return visitExpression(node, arg); |
250 } | 234 } |
251 | 235 |
252 R visitPart(Part node, A arg) => visitLibraryTag(node, arg); | 236 R visitPart(Part node, A arg) => visitLibraryTag(node, arg); |
253 R visitPartOf(PartOf node, A arg) => visitNode(node, arg); | 237 R visitPartOf(PartOf node, A arg) => visitNode(node, arg); |
254 R visitPostfix(Postfix node, A arg) => visitNodeList(node, arg); | 238 R visitPostfix(Postfix node, A arg) => visitNodeList(node, arg); |
255 R visitPrefix(Prefix node, A arg) => visitNodeList(node, arg); | 239 R visitPrefix(Prefix node, A arg) => visitNodeList(node, arg); |
256 R visitRedirectingFactoryBody(RedirectingFactoryBody node, A arg) { | 240 R visitRedirectingFactoryBody(RedirectingFactoryBody node, A arg) { |
(...skipping 15 matching lines...) Expand all Loading... |
272 } | 256 } |
273 | 257 |
274 R visitSwitchCase(SwitchCase node, A arg) => visitNode(node, arg); | 258 R visitSwitchCase(SwitchCase node, A arg) => visitNode(node, arg); |
275 R visitSwitchStatement(SwitchStatement node, A arg) { | 259 R visitSwitchStatement(SwitchStatement node, A arg) { |
276 return visitStatement(node, arg); | 260 return visitStatement(node, arg); |
277 } | 261 } |
278 | 262 |
279 R visitLiteralSymbol(LiteralSymbol node, A arg) => visitExpression(node, arg); | 263 R visitLiteralSymbol(LiteralSymbol node, A arg) => visitExpression(node, arg); |
280 R visitThrow(Throw node, A arg) => visitExpression(node, arg); | 264 R visitThrow(Throw node, A arg) => visitExpression(node, arg); |
281 R visitTryStatement(TryStatement node, A arg) => visitStatement(node, arg); | 265 R visitTryStatement(TryStatement node, A arg) => visitStatement(node, arg); |
| 266 R visitTypeAnnotation(TypeAnnotation node, A arg) => visitNode(node, arg); |
282 R visitTypedef(Typedef node, A arg) => visitNode(node, arg); | 267 R visitTypedef(Typedef node, A arg) => visitNode(node, arg); |
283 R visitTypeAnnotation(TypeAnnotation node, A arg) => visitNode(node, arg); | |
284 R visitTypeVariable(TypeVariable node, A arg) => visitNode(node, arg); | 268 R visitTypeVariable(TypeVariable node, A arg) => visitNode(node, arg); |
285 R visitVariableDefinitions(VariableDefinitions node, A arg) { | 269 R visitVariableDefinitions(VariableDefinitions node, A arg) { |
286 return visitStatement(node, arg); | 270 return visitStatement(node, arg); |
287 } | 271 } |
288 | 272 |
289 R visitWhile(While node, A arg) => visitLoop(node, arg); | 273 R visitWhile(While node, A arg) => visitLoop(node, arg); |
290 R visitYield(Yield node, A arg) => visitStatement(node, arg); | 274 R visitYield(Yield node, A arg) => visitStatement(node, arg); |
291 } | 275 } |
292 | 276 |
293 Token firstBeginToken(Node first, Node second) { | 277 Token firstBeginToken(Node first, Node second) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 ErrorExpression asErrorExpression() => null; | 356 ErrorExpression asErrorExpression() => null; |
373 Export asExport() => null; | 357 Export asExport() => null; |
374 Expression asExpression() => null; | 358 Expression asExpression() => null; |
375 ExpressionStatement asExpressionStatement() => null; | 359 ExpressionStatement asExpressionStatement() => null; |
376 For asFor() => null; | 360 For asFor() => null; |
377 SyncForIn asSyncForIn() => null; | 361 SyncForIn asSyncForIn() => null; |
378 AsyncForIn asAsyncForIn() => null; | 362 AsyncForIn asAsyncForIn() => null; |
379 ForIn asForIn() => null; | 363 ForIn asForIn() => null; |
380 FunctionDeclaration asFunctionDeclaration() => null; | 364 FunctionDeclaration asFunctionDeclaration() => null; |
381 FunctionExpression asFunctionExpression() => null; | 365 FunctionExpression asFunctionExpression() => null; |
382 FunctionTypeAnnotation asFunctionTypeAnnotation() => null; | |
383 Identifier asIdentifier() => null; | 366 Identifier asIdentifier() => null; |
384 If asIf() => null; | 367 If asIf() => null; |
385 Import asImport() => null; | 368 Import asImport() => null; |
386 Label asLabel() => null; | 369 Label asLabel() => null; |
387 LabeledStatement asLabeledStatement() => null; | 370 LabeledStatement asLabeledStatement() => null; |
388 LibraryName asLibraryName() => null; | 371 LibraryName asLibraryName() => null; |
389 LibraryDependency asLibraryDependency() => null; | 372 LibraryDependency asLibraryDependency() => null; |
390 LiteralBool asLiteralBool() => null; | 373 LiteralBool asLiteralBool() => null; |
391 LiteralDouble asLiteralDouble() => null; | 374 LiteralDouble asLiteralDouble() => null; |
392 LiteralInt asLiteralInt() => null; | 375 LiteralInt asLiteralInt() => null; |
393 LiteralList asLiteralList() => null; | 376 LiteralList asLiteralList() => null; |
394 LiteralMap asLiteralMap() => null; | 377 LiteralMap asLiteralMap() => null; |
395 LiteralMapEntry asLiteralMapEntry() => null; | 378 LiteralMapEntry asLiteralMapEntry() => null; |
396 LiteralNull asLiteralNull() => null; | 379 LiteralNull asLiteralNull() => null; |
397 LiteralString asLiteralString() => null; | 380 LiteralString asLiteralString() => null; |
398 LiteralSymbol asLiteralSymbol() => null; | 381 LiteralSymbol asLiteralSymbol() => null; |
399 Metadata asMetadata() => null; | 382 Metadata asMetadata() => null; |
400 MixinApplication asMixinApplication() => null; | 383 MixinApplication asMixinApplication() => null; |
401 Modifiers asModifiers() => null; | 384 Modifiers asModifiers() => null; |
402 NamedArgument asNamedArgument() => null; | 385 NamedArgument asNamedArgument() => null; |
403 NamedMixinApplication asNamedMixinApplication() => null; | 386 NamedMixinApplication asNamedMixinApplication() => null; |
404 NewExpression asNewExpression() => null; | 387 NewExpression asNewExpression() => null; |
405 NodeList asNodeList() => null; | 388 NodeList asNodeList() => null; |
406 NominalTypeAnnotation asNominalTypeAnnotation() => null; | |
407 Operator asOperator() => null; | 389 Operator asOperator() => null; |
408 ParenthesizedExpression asParenthesizedExpression() => null; | 390 ParenthesizedExpression asParenthesizedExpression() => null; |
409 Part asPart() => null; | 391 Part asPart() => null; |
410 PartOf asPartOf() => null; | 392 PartOf asPartOf() => null; |
411 RedirectingFactoryBody asRedirectingFactoryBody() => null; | 393 RedirectingFactoryBody asRedirectingFactoryBody() => null; |
412 Rethrow asRethrow() => null; | 394 Rethrow asRethrow() => null; |
413 Return asReturn() => null; | 395 Return asReturn() => null; |
414 Send asSend() => null; | 396 Send asSend() => null; |
415 SendSet asSendSet() => null; | 397 SendSet asSendSet() => null; |
416 Statement asStatement() => null; | 398 Statement asStatement() => null; |
417 StringInterpolation asStringInterpolation() => null; | 399 StringInterpolation asStringInterpolation() => null; |
418 StringInterpolationPart asStringInterpolationPart() => null; | 400 StringInterpolationPart asStringInterpolationPart() => null; |
419 StringJuxtaposition asStringJuxtaposition() => null; | 401 StringJuxtaposition asStringJuxtaposition() => null; |
420 StringNode asStringNode() => null; | 402 StringNode asStringNode() => null; |
421 SwitchCase asSwitchCase() => null; | 403 SwitchCase asSwitchCase() => null; |
422 SwitchStatement asSwitchStatement() => null; | 404 SwitchStatement asSwitchStatement() => null; |
423 Throw asThrow() => null; | 405 Throw asThrow() => null; |
424 TryStatement asTryStatement() => null; | 406 TryStatement asTryStatement() => null; |
| 407 TypeAnnotation asTypeAnnotation() => null; |
425 TypeVariable asTypeVariable() => null; | 408 TypeVariable asTypeVariable() => null; |
426 Typedef asTypedef() => null; | 409 Typedef asTypedef() => null; |
427 VariableDefinitions asVariableDefinitions() => null; | 410 VariableDefinitions asVariableDefinitions() => null; |
428 While asWhile() => null; | 411 While asWhile() => null; |
429 Yield asYield() => null; | 412 Yield asYield() => null; |
430 | 413 |
431 bool isValidBreakTarget() => false; | 414 bool isValidBreakTarget() => false; |
432 bool isValidContinueTarget() => false; | 415 bool isValidContinueTarget() => false; |
433 bool isThis() => false; | 416 bool isThis() => false; |
434 bool isSuper() => false; | 417 bool isSuper() => false; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 token = name.getEndToken(); | 482 token = name.getEndToken(); |
500 } | 483 } |
501 assert(token != null); | 484 assert(token != null); |
502 return token; | 485 return token; |
503 } | 486 } |
504 | 487 |
505 Token getEndToken() => endToken; | 488 Token getEndToken() => endToken; |
506 } | 489 } |
507 | 490 |
508 class MixinApplication extends Node { | 491 class MixinApplication extends Node { |
509 final NominalTypeAnnotation superclass; | 492 final TypeAnnotation superclass; |
510 final NodeList mixins; | 493 final NodeList mixins; |
511 | 494 |
512 MixinApplication(this.superclass, this.mixins); | 495 MixinApplication(this.superclass, this.mixins); |
513 | 496 |
514 MixinApplication asMixinApplication() => this; | 497 MixinApplication asMixinApplication() => this; |
515 | 498 |
516 accept(Visitor visitor) => visitor.visitMixinApplication(this); | 499 accept(Visitor visitor) => visitor.visitMixinApplication(this); |
517 | 500 |
518 accept1(Visitor1 visitor, arg) => visitor.visitMixinApplication(this, arg); | 501 accept1(Visitor1 visitor, arg) => visitor.visitMixinApplication(this, arg); |
519 | 502 |
520 visitChildren(Visitor visitor) { | 503 visitChildren(Visitor visitor) { |
521 if (superclass != null) superclass.accept(visitor); | 504 if (superclass != null) superclass.accept(visitor); |
522 if (mixins != null) mixins.accept(visitor); | 505 if (mixins != null) mixins.accept(visitor); |
523 } | 506 } |
524 | 507 |
525 visitChildren1(Visitor1 visitor, arg) { | 508 visitChildren1(Visitor1 visitor, arg) { |
526 if (superclass != null) superclass.accept1(visitor, arg); | 509 if (superclass != null) superclass.accept1(visitor, arg); |
527 if (mixins != null) mixins.accept1(visitor, arg); | 510 if (mixins != null) mixins.accept1(visitor, arg); |
528 } | 511 } |
529 | 512 |
530 Token getBeginToken() => superclass.getBeginToken(); | 513 Token getBeginToken() => superclass.getBeginToken(); |
531 Token getEndToken() => mixins.getEndToken(); | 514 Token getEndToken() => mixins.getEndToken(); |
532 } | 515 } |
533 | 516 |
| 517 // TODO(kasperl): Let this share some structure with the typedef for function |
| 518 // type aliases? |
534 class NamedMixinApplication extends Node implements MixinApplication { | 519 class NamedMixinApplication extends Node implements MixinApplication { |
535 final Identifier name; | 520 final Identifier name; |
536 final NodeList typeParameters; | 521 final NodeList typeParameters; |
537 | 522 |
538 final Modifiers modifiers; | 523 final Modifiers modifiers; |
539 final MixinApplication mixinApplication; | 524 final MixinApplication mixinApplication; |
540 final NodeList interfaces; | 525 final NodeList interfaces; |
541 | 526 |
542 final Token classKeyword; | 527 final Token classKeyword; |
543 final Token endToken; | 528 final Token endToken; |
544 | 529 |
545 NamedMixinApplication(this.name, this.typeParameters, this.modifiers, | 530 NamedMixinApplication(this.name, this.typeParameters, this.modifiers, |
546 this.mixinApplication, this.interfaces, this.classKeyword, this.endToken); | 531 this.mixinApplication, this.interfaces, this.classKeyword, this.endToken); |
547 | 532 |
548 NominalTypeAnnotation get superclass => mixinApplication.superclass; | 533 TypeAnnotation get superclass => mixinApplication.superclass; |
549 NodeList get mixins => mixinApplication.mixins; | 534 NodeList get mixins => mixinApplication.mixins; |
550 | 535 |
551 MixinApplication asMixinApplication() => this; | 536 MixinApplication asMixinApplication() => this; |
552 NamedMixinApplication asNamedMixinApplication() => this; | 537 NamedMixinApplication asNamedMixinApplication() => this; |
553 | 538 |
554 accept(Visitor visitor) => visitor.visitNamedMixinApplication(this); | 539 accept(Visitor visitor) => visitor.visitNamedMixinApplication(this); |
555 | 540 |
556 accept1(Visitor1 visitor, arg) { | 541 accept1(Visitor1 visitor, arg) { |
557 return visitor.visitNamedMixinApplication(this, arg); | 542 return visitor.visitNamedMixinApplication(this, arg); |
558 } | 543 } |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 accept1(Visitor1 visitor, arg) => visitor.visitRethrow(this, arg); | 1716 accept1(Visitor1 visitor, arg) => visitor.visitRethrow(this, arg); |
1732 | 1717 |
1733 visitChildren(Visitor visitor) {} | 1718 visitChildren(Visitor visitor) {} |
1734 | 1719 |
1735 visitChildren1(Visitor1 visitor, arg) {} | 1720 visitChildren1(Visitor1 visitor, arg) {} |
1736 | 1721 |
1737 Token getBeginToken() => throwToken; | 1722 Token getBeginToken() => throwToken; |
1738 Token getEndToken() => endToken; | 1723 Token getEndToken() => endToken; |
1739 } | 1724 } |
1740 | 1725 |
1741 abstract class TypeAnnotation extends Node { | 1726 class TypeAnnotation extends Node { |
1742 } | |
1743 | |
1744 class NominalTypeAnnotation extends TypeAnnotation { | |
1745 final Expression typeName; | 1727 final Expression typeName; |
1746 final NodeList typeArguments; | 1728 final NodeList typeArguments; |
1747 | 1729 |
1748 NominalTypeAnnotation(this.typeName, this.typeArguments); | 1730 TypeAnnotation(Expression this.typeName, NodeList this.typeArguments); |
1749 | 1731 |
1750 NominalTypeAnnotation asNominalTypeAnnotation() => this; | 1732 TypeAnnotation asTypeAnnotation() => this; |
1751 | 1733 |
1752 accept(Visitor visitor) => visitor.visitNominalTypeAnnotation(this); | 1734 accept(Visitor visitor) => visitor.visitTypeAnnotation(this); |
1753 | 1735 |
1754 accept1(Visitor1 visitor, arg) { | 1736 accept1(Visitor1 visitor, arg) => visitor.visitTypeAnnotation(this, arg); |
1755 return visitor.visitNominalTypeAnnotation(this, arg); | |
1756 } | |
1757 | 1737 |
1758 visitChildren(Visitor visitor) { | 1738 visitChildren(Visitor visitor) { |
1759 typeName.accept(visitor); | 1739 typeName.accept(visitor); |
1760 if (typeArguments != null) typeArguments.accept(visitor); | 1740 if (typeArguments != null) typeArguments.accept(visitor); |
1761 } | 1741 } |
1762 | 1742 |
1763 visitChildren1(Visitor1 visitor, arg) { | 1743 visitChildren1(Visitor1 visitor, arg) { |
1764 typeName.accept1(visitor, arg); | 1744 typeName.accept1(visitor, arg); |
1765 if (typeArguments != null) typeArguments.accept1(visitor, arg); | 1745 if (typeArguments != null) typeArguments.accept1(visitor, arg); |
1766 } | 1746 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 } | 1822 } |
1843 | 1823 |
1844 Token getBeginToken() { | 1824 Token getBeginToken() { |
1845 var token = firstBeginToken(modifiers, type); | 1825 var token = firstBeginToken(modifiers, type); |
1846 if (token == null) { | 1826 if (token == null) { |
1847 token = definitions.getBeginToken(); | 1827 token = definitions.getBeginToken(); |
1848 } | 1828 } |
1849 return token; | 1829 return token; |
1850 } | 1830 } |
1851 | 1831 |
1852 Token getEndToken() { | 1832 Token getEndToken() => definitions.getEndToken(); |
1853 var result = definitions.getEndToken(); | |
1854 if (result != null) return result; | |
1855 assert(definitions.nodes.length == 1); | |
1856 assert(definitions.nodes.last == null); | |
1857 return type.getEndToken(); | |
1858 } | |
1859 } | 1833 } |
1860 | 1834 |
1861 abstract class Loop extends Statement { | 1835 abstract class Loop extends Statement { |
1862 Expression get condition; | 1836 Expression get condition; |
1863 final Statement body; | 1837 final Statement body; |
1864 | 1838 |
1865 Loop(this.body); | 1839 Loop(this.body); |
1866 | 1840 |
1867 bool isValidContinueTarget() => true; | 1841 bool isValidContinueTarget() => true; |
1868 } | 1842 } |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 visitChildren(Visitor visitor) => identifiers.accept(visitor); | 2850 visitChildren(Visitor visitor) => identifiers.accept(visitor); |
2877 | 2851 |
2878 visitChildren1(Visitor1 visitor, arg) => identifiers.accept1(visitor, arg); | 2852 visitChildren1(Visitor1 visitor, arg) => identifiers.accept1(visitor, arg); |
2879 | 2853 |
2880 Token getBeginToken() => keywordToken; | 2854 Token getBeginToken() => keywordToken; |
2881 | 2855 |
2882 Token getEndToken() => identifiers.getEndToken(); | 2856 Token getEndToken() => identifiers.getEndToken(); |
2883 } | 2857 } |
2884 | 2858 |
2885 class Typedef extends Node { | 2859 class Typedef extends Node { |
2886 final bool isGeneralizedTypeAlias; | |
2887 | |
2888 /// Parameters to the template. | |
2889 /// | |
2890 /// For example, `T` and `S` are template parameters in the following | |
2891 /// typedef: `typedef F<S, T> = Function(S, T)`, or, in the inlined syntax, | |
2892 /// `typedef F<S, T>(S x, T y)`. | |
2893 final NodeList templateParameters; | |
2894 | |
2895 final TypeAnnotation returnType; | 2860 final TypeAnnotation returnType; |
2896 final Identifier name; | 2861 final Identifier name; |
2897 /// The generic type parameters to the function type. | |
2898 /// | |
2899 /// For example `A` and `B` (but not `T`) are type parameters in | |
2900 /// `typedef F<T> = Function<A, B>(A, B, T)`; | |
2901 final NodeList typeParameters; | 2862 final NodeList typeParameters; |
2902 final NodeList formals; | 2863 final NodeList formals; |
2903 | 2864 |
2904 final Token typedefKeyword; | 2865 final Token typedefKeyword; |
2905 final Token endToken; | 2866 final Token endToken; |
2906 | 2867 |
2907 Typedef(this.isGeneralizedTypeAlias, this.templateParameters, this.returnType, | 2868 Typedef(this.returnType, this.name, this.typeParameters, this.formals, |
2908 this.name, this.typeParameters, this.formals, this.typedefKeyword, | 2869 this.typedefKeyword, this.endToken); |
2909 this.endToken); | |
2910 | 2870 |
2911 Typedef asTypedef() => this; | 2871 Typedef asTypedef() => this; |
2912 | 2872 |
2913 accept(Visitor visitor) => visitor.visitTypedef(this); | 2873 accept(Visitor visitor) => visitor.visitTypedef(this); |
2914 | 2874 |
2915 accept1(Visitor1 visitor, arg) => visitor.visitTypedef(this, arg); | 2875 accept1(Visitor1 visitor, arg) => visitor.visitTypedef(this, arg); |
2916 | 2876 |
2917 visitChildren(Visitor visitor) { | 2877 visitChildren(Visitor visitor) { |
2918 if (templateParameters != null) templateParameters.accept(visitor); | |
2919 if (returnType != null) returnType.accept(visitor); | 2878 if (returnType != null) returnType.accept(visitor); |
2920 name.accept(visitor); | 2879 name.accept(visitor); |
2921 if (typeParameters != null) typeParameters.accept(visitor); | 2880 if (typeParameters != null) typeParameters.accept(visitor); |
2922 formals.accept(visitor); | 2881 formals.accept(visitor); |
2923 } | 2882 } |
2924 | 2883 |
2925 visitChildren1(Visitor1 visitor, arg) { | 2884 visitChildren1(Visitor1 visitor, arg) { |
2926 if (templateParameters != null) templateParameters.accept1(visitor, arg); | |
2927 if (returnType != null) returnType.accept1(visitor, arg); | 2885 if (returnType != null) returnType.accept1(visitor, arg); |
2928 name.accept1(visitor, arg); | 2886 name.accept1(visitor, arg); |
2929 if (typeParameters != null) typeParameters.accept1(visitor, arg); | 2887 if (typeParameters != null) typeParameters.accept1(visitor, arg); |
2930 formals.accept1(visitor, arg); | 2888 formals.accept1(visitor, arg); |
2931 } | 2889 } |
2932 | 2890 |
2933 Token getBeginToken() => typedefKeyword; | 2891 Token getBeginToken() => typedefKeyword; |
2934 | 2892 |
2935 Token getEndToken() => endToken; | 2893 Token getEndToken() => endToken; |
2936 } | 2894 } |
2937 | 2895 |
2938 class FunctionTypeAnnotation extends TypeAnnotation { | |
2939 final TypeAnnotation returnType; | |
2940 final Token functionToken; | |
2941 final NodeList typeParameters; | |
2942 final NodeList formals; | |
2943 | |
2944 FunctionTypeAnnotation( | |
2945 this.returnType, this.functionToken, this.typeParameters, this.formals); | |
2946 | |
2947 FunctionTypeAnnotation asFunctionTypeAnnotation() => this; | |
2948 | |
2949 accept(Visitor visitor) => visitor.visitFunctionTypeAnnotation(this); | |
2950 | |
2951 accept1(Visitor1 visitor, arg) { | |
2952 return visitor.visitFunctionTypeAnnotation(this, arg); | |
2953 } | |
2954 | |
2955 visitChildren(Visitor visitor) { | |
2956 if (returnType != null) returnType.accept(visitor); | |
2957 if (typeParameters != null) typeParameters.accept(visitor); | |
2958 formals.accept(visitor); | |
2959 } | |
2960 | |
2961 visitChildren1(Visitor1 visitor, arg) { | |
2962 if (returnType != null) returnType.accept1(visitor, arg); | |
2963 if (typeParameters != null) typeParameters.accept1(visitor, arg); | |
2964 formals.accept1(visitor, arg); | |
2965 } | |
2966 | |
2967 Token getBeginToken() { | |
2968 if (returnType != null) return returnType.getBeginToken(); | |
2969 return functionToken; | |
2970 } | |
2971 | |
2972 Token getEndToken() => formals.getEndToken(); | |
2973 } | |
2974 | |
2975 class TryStatement extends Statement { | 2896 class TryStatement extends Statement { |
2976 final Block tryBlock; | 2897 final Block tryBlock; |
2977 final NodeList catchBlocks; | 2898 final NodeList catchBlocks; |
2978 final Block finallyBlock; | 2899 final Block finallyBlock; |
2979 | 2900 |
2980 final Token tryKeyword; | 2901 final Token tryKeyword; |
2981 final Token finallyKeyword; | 2902 final Token finallyKeyword; |
2982 | 2903 |
2983 TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock, | 2904 TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock, |
2984 this.tryKeyword, this.finallyKeyword); | 2905 this.tryKeyword, this.finallyKeyword); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 get getOrSet => null; | 3132 get getOrSet => null; |
3212 get isRedirectingFactory => false; | 3133 get isRedirectingFactory => false; |
3213 bool get hasBody => false; | 3134 bool get hasBody => false; |
3214 bool get hasEmptyBody => false; | 3135 bool get hasEmptyBody => false; |
3215 | 3136 |
3216 // VariableDefinitions. | 3137 // VariableDefinitions. |
3217 get metadata => null; | 3138 get metadata => null; |
3218 get type => null; | 3139 get type => null; |
3219 | 3140 |
3220 // Typedef. | 3141 // Typedef. |
3221 get isGeneralizedTypeAlias => null; | |
3222 get templateParameters => null; | |
3223 get typeParameters => null; | 3142 get typeParameters => null; |
3224 get formals => null; | 3143 get formals => null; |
3225 get typedefKeyword => null; | 3144 get typedefKeyword => null; |
3226 } | 3145 } |
OLD | NEW |