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

Side by Side Diff: pkg/compiler/lib/src/tree/nodes.dart

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

Powered by Google App Engine
This is Rietveld 408576698