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

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

Issue 1863403002: Add Visitor1<R, A> (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 8 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 | « no previous file | no next file » | 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 '../tokens/precedence_constants.dart' as Precedence show FUNCTION_INFO; 8 import '../tokens/precedence_constants.dart' as Precedence show FUNCTION_INFO;
9 import '../tokens/token.dart' show BeginGroupToken, Token; 9 import '../tokens/token.dart' show BeginGroupToken, Token;
10 import '../tokens/token_constants.dart' as Tokens show IDENTIFIER_TOKEN, KEYWORD _TOKEN, PLUS_TOKEN; 10 import '../tokens/token_constants.dart' as Tokens show IDENTIFIER_TOKEN, KEYWORD _TOKEN, PLUS_TOKEN;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 R visitThrow(Throw node) => visitExpression(node); 103 R visitThrow(Throw node) => visitExpression(node);
104 R visitTryStatement(TryStatement node) => visitStatement(node); 104 R visitTryStatement(TryStatement node) => visitStatement(node);
105 R visitTypeAnnotation(TypeAnnotation node) => visitNode(node); 105 R visitTypeAnnotation(TypeAnnotation node) => visitNode(node);
106 R visitTypedef(Typedef node) => visitNode(node); 106 R visitTypedef(Typedef node) => visitNode(node);
107 R visitTypeVariable(TypeVariable node) => visitNode(node); 107 R visitTypeVariable(TypeVariable node) => visitNode(node);
108 R visitVariableDefinitions(VariableDefinitions node) => visitStatement(node); 108 R visitVariableDefinitions(VariableDefinitions node) => visitStatement(node);
109 R visitWhile(While node) => visitLoop(node); 109 R visitWhile(While node) => visitLoop(node);
110 R visitYield(Yield node) => visitStatement(node); 110 R visitYield(Yield node) => visitStatement(node);
111 } 111 }
112 112
113 /// Visitor for [Node]s that take an additional argument of type [A] and returns
114 /// a value of type [R].
115 abstract class Visitor1<R, A> {
116 const Visitor1();
117
118 R visitNode(Node node, A arg);
119
120 R visitAssert(Assert node, A arg) => visitStatement(node, arg);
121 R visitAsyncForIn(AsyncForIn node, A arg) => visitLoop(node, arg);
122 R visitAsyncModifier(AsyncModifier node, A arg) => visitNode(node, arg);
123 R visitAwait(Await node, A arg) => visitExpression(node, arg);
124 R visitBlock(Block node, A arg) => visitStatement(node, arg);
125 R visitBreakStatement(BreakStatement node, A arg) {
126 return visitGotoStatement(node, arg);
127 }
128 R visitCascade(Cascade node, A arg) => visitExpression(node, arg);
129 R visitCascadeReceiver(CascadeReceiver node, A arg) {
130 return visitExpression(node, arg);
131 }
132 R visitCaseMatch(CaseMatch node, A arg) => visitNode(node, arg);
133 R visitCatchBlock(CatchBlock node, A arg) => visitNode(node, arg);
134 R visitClassNode(ClassNode node, A arg) => visitNode(node, arg);
135 R visitCombinator(Combinator node, A arg) => visitNode(node, arg);
136 R visitConditional(Conditional node, A arg) => visitExpression(node, arg);
137 R visitConditionalUri(ConditionalUri node, A arg) {
138 return visitNode(node, arg);
139 }
140 R visitContinueStatement(ContinueStatement node, A arg) {
141 return visitGotoStatement(node, arg);
142 }
143 R visitDottedName(DottedName node, A arg) {
144 return visitExpression(node, arg);
145 }
146 R visitDoWhile(DoWhile node, A arg) => visitLoop(node, arg);
147 R visitEmptyStatement(EmptyStatement node, A arg) {
148 return visitStatement(node, arg);
149 }
150 R visitEnum(Enum node, A arg) => visitNode(node, arg);
151 R visitExport(Export node, A arg) => visitLibraryDependency(node, arg);
152 R visitExpression(Expression node, A arg) => visitNode(node, arg);
153 R visitExpressionStatement(ExpressionStatement node, A arg) {
154 return visitStatement(node, arg);
155 }
156 R visitFor(For node, A arg) => visitLoop(node, arg);
157 R visitFunctionDeclaration(FunctionDeclaration node, A arg) {
158 return visitStatement(node, arg);
159 }
160 R visitFunctionExpression(FunctionExpression node, A arg) {
161 return visitExpression(node, arg);
162 }
163 R visitGotoStatement(GotoStatement node, A arg) {
164 return visitStatement(node, arg);
165 }
166 R visitIdentifier(Identifier node, A arg) {
167 return visitExpression(node, arg);
168 }
169 R visitImport(Import node, A arg) {
170 return visitLibraryDependency(node, arg);
171 }
172 R visitIf(If node, A arg) => visitStatement(node, arg);
173 R visitLabel(Label node, A arg) => visitNode(node, arg);
174 R visitLabeledStatement(LabeledStatement node, A arg) {
175 return visitStatement(node, arg);
176 }
177 R visitLibraryDependency(LibraryDependency node, A arg) {
178 return visitLibraryTag(node, arg);
179 }
180 R visitLibraryName(LibraryName node, A arg) => visitLibraryTag(node, arg);
181 R visitLibraryTag(LibraryTag node, A arg) => visitNode(node, arg);
182 R visitLiteral(Literal node, A arg) => visitExpression(node, arg);
183 R visitLiteralBool(LiteralBool node, A arg) => visitLiteral(node, arg);
184 R visitLiteralDouble(LiteralDouble node, A arg) => visitLiteral(node, arg);
185 R visitLiteralInt(LiteralInt node, A arg) => visitLiteral(node, arg);
186 R visitLiteralList(LiteralList node, A arg) => visitExpression(node, arg);
187 R visitLiteralMap(LiteralMap node, A arg) => visitExpression(node, arg);
188 R visitLiteralMapEntry(LiteralMapEntry node, A arg) => visitNode(node, arg);
189 R visitLiteralNull(LiteralNull node, A arg) => visitLiteral(node, arg);
190 R visitLiteralString(LiteralString node, A arg) => visitStringNode(node, arg);
191 R visitStringJuxtaposition(StringJuxtaposition node, A arg) {
192 return visitStringNode(node, arg);
193 }
194 R visitSyncForIn(SyncForIn node, A arg) => visitLoop(node, arg);
195 R visitLoop(Loop node, A arg) => visitStatement(node, arg);
196 R visitMetadata(Metadata node, A arg) => visitNode(node, arg);
197 R visitMixinApplication(MixinApplication node, A arg) => visitNode(node, arg);
198 R visitModifiers(Modifiers node, A arg) => visitNode(node, arg);
199 R visitNamedArgument(NamedArgument node, A arg) => visitExpression(node, arg);
200 R visitNamedMixinApplication(NamedMixinApplication node, A arg) {
201 return visitMixinApplication(node, arg);
202 }
203 R visitNewExpression(NewExpression node, A arg) => visitExpression(node, arg);
204 R visitNodeList(NodeList node, A arg) => visitNode(node, arg);
205 R visitOperator(Operator node, A arg) => visitIdentifier(node, arg);
206 R visitParenthesizedExpression(ParenthesizedExpression node, A arg) {
207 return visitExpression(node, arg);
208 }
209 R visitPart(Part node, A arg) => visitLibraryTag(node, arg);
210 R visitPartOf(PartOf node, A arg) => visitNode(node, arg);
211 R visitPostfix(Postfix node, A arg) => visitNodeList(node, arg);
212 R visitPrefix(Prefix node, A arg) => visitNodeList(node, arg);
213 R visitRedirectingFactoryBody(RedirectingFactoryBody node, A arg) {
214 return visitStatement(node, arg);
215 }
216 R visitRethrow(Rethrow node, A arg) => visitStatement(node, arg);
217 R visitReturn(Return node, A arg) => visitStatement(node, arg);
218 R visitSend(Send node, A arg) => visitExpression(node, arg);
219 R visitSendSet(SendSet node, A arg) => visitSend(node, arg);
220 R visitStatement(Statement node, A arg) => visitNode(node, arg);
221 R visitStringNode(StringNode node, A arg) => visitExpression(node, arg);
222 R visitStringInterpolation(StringInterpolation node, A arg) {
223 return visitStringNode(node, arg);
224 }
225 R visitStringInterpolationPart(StringInterpolationPart node, A arg) {
226 return visitNode(node, arg);
227 }
228 R visitSwitchCase(SwitchCase node, A arg) => visitNode(node, arg);
229 R visitSwitchStatement(SwitchStatement node, A arg) {
230 return visitStatement(node, arg);
231 }
232 R visitLiteralSymbol(LiteralSymbol node, A arg) => visitExpression(node, arg);
233 R visitThrow(Throw node, A arg) => visitExpression(node, arg);
234 R visitTryStatement(TryStatement node, A arg) => visitStatement(node, arg);
235 R visitTypeAnnotation(TypeAnnotation node, A arg) => visitNode(node, arg);
236 R visitTypedef(Typedef node, A arg) => visitNode(node, arg);
237 R visitTypeVariable(TypeVariable node, A arg) => visitNode(node, arg);
238 R visitVariableDefinitions(VariableDefinitions node, A arg) {
239 return visitStatement(node, arg);
240 }
241 R visitWhile(While node, A arg) => visitLoop(node, arg);
242 R visitYield(Yield node, A arg) => visitStatement(node, arg);
243 }
244
245
113 Token firstBeginToken(Node first, Node second) { 246 Token firstBeginToken(Node first, Node second) {
114 Token token = null; 247 Token token = null;
115 if (first != null) { 248 if (first != null) {
116 token = first.getBeginToken(); 249 token = first.getBeginToken();
117 } 250 }
118 if (token == null && second != null) { 251 if (token == null && second != null) {
119 // [token] might be null even when [first] is not, e.g. for empty Modifiers. 252 // [token] might be null even when [first] is not, e.g. for empty Modifiers.
120 token = second.getBeginToken(); 253 token = second.getBeginToken();
121 } 254 }
122 return token; 255 return token;
(...skipping 11 matching lines...) Expand all
134 * "Token". 267 * "Token".
135 */ 268 */
136 abstract class Node extends NullTreeElementMixin implements Spannable { 269 abstract class Node extends NullTreeElementMixin implements Spannable {
137 final int hashCode; 270 final int hashCode;
138 static int _HASH_COUNTER = 0; 271 static int _HASH_COUNTER = 0;
139 272
140 Node() : hashCode = ++_HASH_COUNTER; 273 Node() : hashCode = ++_HASH_COUNTER;
141 274
142 accept(Visitor visitor); 275 accept(Visitor visitor);
143 276
277 accept1(Visitor1 visitor, arg);
278
144 visitChildren(Visitor visitor); 279 visitChildren(Visitor visitor);
145 280
281 visitChildren1(Visitor1 visitor, arg);
282
146 /** 283 /**
147 * Returns this node unparsed to Dart source string. 284 * Returns this node unparsed to Dart source string.
148 */ 285 */
149 toString() => unparse(this); 286 toString() => unparse(this);
150 287
151 /** 288 /**
152 * Returns Xml-like tree representation of this node. 289 * Returns Xml-like tree representation of this node.
153 */ 290 */
154 toDebugString() { 291 toDebugString() {
155 return PrettyPrinter.prettyPrint(this); 292 return PrettyPrinter.prettyPrint(this);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 final Token endToken; 401 final Token endToken;
265 402
266 ClassNode(this.modifiers, this.name, this.typeParameters, this.superclass, 403 ClassNode(this.modifiers, this.name, this.typeParameters, this.superclass,
267 this.interfaces, this.beginToken, 404 this.interfaces, this.beginToken,
268 this.extendsKeyword, this.body, this.endToken); 405 this.extendsKeyword, this.body, this.endToken);
269 406
270 ClassNode asClassNode() => this; 407 ClassNode asClassNode() => this;
271 408
272 accept(Visitor visitor) => visitor.visitClassNode(this); 409 accept(Visitor visitor) => visitor.visitClassNode(this);
273 410
411 accept1(Visitor1 visitor, arg) => visitor.visitClassNode(this, arg);
412
274 visitChildren(Visitor visitor) { 413 visitChildren(Visitor visitor) {
275 if (name != null) name.accept(visitor); 414 if (name != null) name.accept(visitor);
276 if (typeParameters != null) typeParameters.accept(visitor); 415 if (typeParameters != null) typeParameters.accept(visitor);
277 if (superclass != null) superclass.accept(visitor); 416 if (superclass != null) superclass.accept(visitor);
278 if (interfaces != null) interfaces.accept(visitor); 417 if (interfaces != null) interfaces.accept(visitor);
279 if (body != null) body.accept(visitor); 418 if (body != null) body.accept(visitor);
280 } 419 }
281 420
421 visitChildren1(Visitor1 visitor, arg) {
422 if (name != null) name.accept1(visitor, arg);
423 if (typeParameters != null) typeParameters.accept1(visitor, arg);
424 if (superclass != null) superclass.accept1(visitor, arg);
425 if (interfaces != null) interfaces.accept1(visitor, arg);
426 if (body != null) body.accept1(visitor, arg);
427 }
428
282 Token getBeginToken() => beginToken; 429 Token getBeginToken() => beginToken;
283 430
284 @override 431 @override
285 Token getPrefixEndToken() { 432 Token getPrefixEndToken() {
286 Token token; 433 Token token;
287 if (interfaces != null) { 434 if (interfaces != null) {
288 token = interfaces.getEndToken(); 435 token = interfaces.getEndToken();
289 } 436 }
290 if (token == null && superclass != null) { 437 if (token == null && superclass != null) {
291 token = superclass.getEndToken(); 438 token = superclass.getEndToken();
(...skipping 14 matching lines...) Expand all
306 class MixinApplication extends Node { 453 class MixinApplication extends Node {
307 final TypeAnnotation superclass; 454 final TypeAnnotation superclass;
308 final NodeList mixins; 455 final NodeList mixins;
309 456
310 MixinApplication(this.superclass, this.mixins); 457 MixinApplication(this.superclass, this.mixins);
311 458
312 MixinApplication asMixinApplication() => this; 459 MixinApplication asMixinApplication() => this;
313 460
314 accept(Visitor visitor) => visitor.visitMixinApplication(this); 461 accept(Visitor visitor) => visitor.visitMixinApplication(this);
315 462
463 accept1(Visitor1 visitor, arg) => visitor.visitMixinApplication(this, arg);
464
316 visitChildren(Visitor visitor) { 465 visitChildren(Visitor visitor) {
317 if (superclass != null) superclass.accept(visitor); 466 if (superclass != null) superclass.accept(visitor);
318 if (mixins != null) mixins.accept(visitor); 467 if (mixins != null) mixins.accept(visitor);
319 } 468 }
320 469
470 visitChildren1(Visitor1 visitor, arg) {
471 if (superclass != null) superclass.accept1(visitor, arg);
472 if (mixins != null) mixins.accept1(visitor, arg);
473 }
474
321 Token getBeginToken() => superclass.getBeginToken(); 475 Token getBeginToken() => superclass.getBeginToken();
322 Token getEndToken() => mixins.getEndToken(); 476 Token getEndToken() => mixins.getEndToken();
323 } 477 }
324 478
325 // TODO(kasperl): Let this share some structure with the typedef for function 479 // TODO(kasperl): Let this share some structure with the typedef for function
326 // type aliases? 480 // type aliases?
327 class NamedMixinApplication extends Node implements MixinApplication { 481 class NamedMixinApplication extends Node implements MixinApplication {
328 final Identifier name; 482 final Identifier name;
329 final NodeList typeParameters; 483 final NodeList typeParameters;
330 484
331 final Modifiers modifiers; 485 final Modifiers modifiers;
332 final MixinApplication mixinApplication; 486 final MixinApplication mixinApplication;
333 final NodeList interfaces; 487 final NodeList interfaces;
334 488
335 final Token classKeyword; 489 final Token classKeyword;
336 final Token endToken; 490 final Token endToken;
337 491
338 NamedMixinApplication(this.name, this.typeParameters, 492 NamedMixinApplication(this.name, this.typeParameters,
339 this.modifiers, this.mixinApplication, this.interfaces, 493 this.modifiers, this.mixinApplication, this.interfaces,
340 this.classKeyword, this.endToken); 494 this.classKeyword, this.endToken);
341 495
342 TypeAnnotation get superclass => mixinApplication.superclass; 496 TypeAnnotation get superclass => mixinApplication.superclass;
343 NodeList get mixins => mixinApplication.mixins; 497 NodeList get mixins => mixinApplication.mixins;
344 498
345 MixinApplication asMixinApplication() => this; 499 MixinApplication asMixinApplication() => this;
346 NamedMixinApplication asNamedMixinApplication() => this; 500 NamedMixinApplication asNamedMixinApplication() => this;
347 501
348 accept(Visitor visitor) => visitor.visitNamedMixinApplication(this); 502 accept(Visitor visitor) => visitor.visitNamedMixinApplication(this);
349 503
504 accept1(Visitor1 visitor, arg) {
505 return visitor.visitNamedMixinApplication(this, arg);
506 }
507
350 visitChildren(Visitor visitor) { 508 visitChildren(Visitor visitor) {
351 name.accept(visitor); 509 name.accept(visitor);
352 if (typeParameters != null) typeParameters.accept(visitor); 510 if (typeParameters != null) typeParameters.accept(visitor);
353 if (modifiers != null) modifiers.accept(visitor); 511 if (modifiers != null) modifiers.accept(visitor);
354 if (interfaces != null) interfaces.accept(visitor); 512 if (interfaces != null) interfaces.accept(visitor);
355 mixinApplication.accept(visitor); 513 mixinApplication.accept(visitor);
356 } 514 }
357 515
516 visitChildren1(Visitor1 visitor, arg) {
517 name.accept1(visitor, arg);
518 if (typeParameters != null) typeParameters.accept1(visitor, arg);
519 if (modifiers != null) modifiers.accept1(visitor, arg);
520 if (interfaces != null) interfaces.accept1(visitor, arg);
521 mixinApplication.accept1(visitor, arg);
522 }
523
358 Token getBeginToken() => classKeyword; 524 Token getBeginToken() => classKeyword;
359 Token getEndToken() => endToken; 525 Token getEndToken() => endToken;
360 } 526 }
361 527
362 abstract class Expression extends Node { 528 abstract class Expression extends Node {
363 Expression(); 529 Expression();
364 530
365 Expression asExpression() => this; 531 Expression asExpression() => this;
366
367 // TODO(ahe): make class abstract instead of adding an abstract method.
368 accept(Visitor visitor);
369 } 532 }
370 533
371 abstract class Statement extends Node { 534 abstract class Statement extends Node {
372 Statement(); 535 Statement();
373 536
374 Statement asStatement() => this; 537 Statement asStatement() => this;
375 538
376 // TODO(ahe): make class abstract instead of adding an abstract method.
377 accept(Visitor visitor);
378
379 bool isValidBreakTarget() => true; 539 bool isValidBreakTarget() => true;
380 } 540 }
381 541
382 /// Erroneous expression that behaves as a literal null. 542 /// Erroneous expression that behaves as a literal null.
383 class ErrorExpression extends LiteralNull { 543 class ErrorExpression extends LiteralNull {
384 ErrorExpression(token) 544 ErrorExpression(token)
385 : super(token); 545 : super(token);
386 546
387 ErrorExpression asErrorExpression() => this; 547 ErrorExpression asErrorExpression() => this;
388 548
(...skipping 27 matching lines...) Expand all
416 Send.prefix(this.receiver, this.selector, 576 Send.prefix(this.receiver, this.selector,
417 [Node argument = null, this.isConditional = false]) 577 [Node argument = null, this.isConditional = false])
418 : argumentsNode = (argument == null) 578 : argumentsNode = (argument == null)
419 ? new Prefix() 579 ? new Prefix()
420 : new Prefix.singleton(argument); 580 : new Prefix.singleton(argument);
421 581
422 Send asSend() => this; 582 Send asSend() => this;
423 583
424 accept(Visitor visitor) => visitor.visitSend(this); 584 accept(Visitor visitor) => visitor.visitSend(this);
425 585
586 accept1(Visitor1 visitor, arg) => visitor.visitSend(this, arg);
587
426 visitChildren(Visitor visitor) { 588 visitChildren(Visitor visitor) {
427 if (receiver != null) receiver.accept(visitor); 589 if (receiver != null) receiver.accept(visitor);
428 if (selector != null) selector.accept(visitor); 590 if (selector != null) selector.accept(visitor);
429 if (argumentsNode != null) argumentsNode.accept(visitor); 591 if (argumentsNode != null) argumentsNode.accept(visitor);
430 } 592 }
431 593
594 visitChildren1(Visitor1 visitor, arg) {
595 if (receiver != null) receiver.accept1(visitor, arg);
596 if (selector != null) selector.accept1(visitor, arg);
597 if (argumentsNode != null) argumentsNode.accept1(visitor, arg);
598 }
599
432 int argumentCount() { 600 int argumentCount() {
433 return (argumentsNode == null) ? -1 : argumentsNode.slowLength(); 601 return (argumentsNode == null) ? -1 : argumentsNode.slowLength();
434 } 602 }
435 603
436 bool get isSuperCall { 604 bool get isSuperCall {
437 return receiver != null && receiver.isSuper(); 605 return receiver != null && receiver.isSuper();
438 } 606 }
439 bool get isOperator => selector is Operator; 607 bool get isOperator => selector is Operator;
440 bool get isPropertyAccess => argumentsNode == null; 608 bool get isPropertyAccess => argumentsNode == null;
441 bool get isFunctionObjectInvocation => selector == null; 609 bool get isFunctionObjectInvocation => selector == null;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 SendSet.prefix(receiver, 690 SendSet.prefix(receiver,
523 selector, 691 selector,
524 this.assignmentOperator, 692 this.assignmentOperator,
525 [Node argument = null, bool isConditional = false]) 693 [Node argument = null, bool isConditional = false])
526 : super.prefix(receiver, selector, argument, isConditional); 694 : super.prefix(receiver, selector, argument, isConditional);
527 695
528 SendSet asSendSet() => this; 696 SendSet asSendSet() => this;
529 697
530 accept(Visitor visitor) => visitor.visitSendSet(this); 698 accept(Visitor visitor) => visitor.visitSendSet(this);
531 699
700 accept1(Visitor1 visitor, arg) => visitor.visitSendSet(this, arg);
701
702 visitChildren(Visitor visitor) {
703 super.visitChildren(visitor);
704 if (assignmentOperator != null) assignmentOperator.accept(visitor);
705 }
706
707 visitChildren1(Visitor1 visitor, arg) {
708 super.visitChildren1(visitor, arg);
709 if (assignmentOperator != null) assignmentOperator.accept1(visitor, arg);
710 }
711
532 /// `true` if this send is not a simple assignment. 712 /// `true` if this send is not a simple assignment.
533 bool get isComplex => !identical(assignmentOperator.source, '='); 713 bool get isComplex => !identical(assignmentOperator.source, '=');
534 714
535 /// Whether this is an if-null assignment of the form `a ??= b`. 715 /// Whether this is an if-null assignment of the form `a ??= b`.
536 bool get isIfNullAssignment => 716 bool get isIfNullAssignment =>
537 identical(assignmentOperator.source, '??='); 717 identical(assignmentOperator.source, '??=');
538 718
539 visitChildren(Visitor visitor) {
540 super.visitChildren(visitor);
541 if (assignmentOperator != null) assignmentOperator.accept(visitor);
542 }
543
544 Send copyWithReceiver(Node newReceiver, bool isConditional) { 719 Send copyWithReceiver(Node newReceiver, bool isConditional) {
545 assert(receiver == null); 720 assert(receiver == null);
546 return new SendSet(newReceiver, selector, assignmentOperator, 721 return new SendSet(newReceiver, selector, assignmentOperator,
547 argumentsNode, isConditional); 722 argumentsNode, isConditional);
548 } 723 }
549 724
550 Token getBeginToken() { 725 Token getBeginToken() {
551 if (isPrefix) return assignmentOperator.getBeginToken(); 726 if (isPrefix) return assignmentOperator.getBeginToken();
552 return super.getBeginToken(); 727 return super.getBeginToken();
553 } 728 }
(...skipping 10 matching lines...) Expand all
564 739
565 // Note: we expect that send.receiver is null. 740 // Note: we expect that send.receiver is null.
566 final Send send; 741 final Send send;
567 742
568 NewExpression([this.newToken, this.send]); 743 NewExpression([this.newToken, this.send]);
569 744
570 NewExpression asNewExpression() => this; 745 NewExpression asNewExpression() => this;
571 746
572 accept(Visitor visitor) => visitor.visitNewExpression(this); 747 accept(Visitor visitor) => visitor.visitNewExpression(this);
573 748
749 accept1(Visitor1 visitor, arg) => visitor.visitNewExpression(this, arg);
750
574 visitChildren(Visitor visitor) { 751 visitChildren(Visitor visitor) {
575 if (send != null) send.accept(visitor); 752 if (send != null) send.accept(visitor);
576 } 753 }
577 754
755 visitChildren1(Visitor1 visitor, arg) {
756 if (send != null) send.accept1(visitor, arg);
757 }
758
578 bool get isConst { 759 bool get isConst {
579 return newToken == null || identical(newToken.stringValue, 'const'); 760 return newToken == null || identical(newToken.stringValue, 'const');
580 } 761 }
581 762
582 Token getBeginToken() => newToken != null ? newToken : send.getBeginToken(); 763 Token getBeginToken() => newToken != null ? newToken : send.getBeginToken();
583 764
584 Token getEndToken() => send.getEndToken(); 765 Token getEndToken() => send.getEndToken();
585 } 766 }
586 767
587 class NodeList extends Node with IterableMixin<Node> { 768 class NodeList extends Node with IterableMixin<Node> {
(...skipping 22 matching lines...) Expand all
610 int slowLength() { 791 int slowLength() {
611 int result = 0; 792 int result = 0;
612 for (Link<Node> cursor = nodes; !cursor.isEmpty; cursor = cursor.tail) { 793 for (Link<Node> cursor = nodes; !cursor.isEmpty; cursor = cursor.tail) {
613 result++; 794 result++;
614 } 795 }
615 return result; 796 return result;
616 } 797 }
617 798
618 accept(Visitor visitor) => visitor.visitNodeList(this); 799 accept(Visitor visitor) => visitor.visitNodeList(this);
619 800
801 accept1(Visitor1 visitor, arg) => visitor.visitNodeList(this, arg);
802
620 visitChildren(Visitor visitor) { 803 visitChildren(Visitor visitor) {
621 if (nodes == null) return; 804 if (nodes == null) return;
622 for (Link<Node> link = nodes; !link.isEmpty; link = link.tail) { 805 for (Link<Node> link = nodes; !link.isEmpty; link = link.tail) {
623 if (link.head != null) link.head.accept(visitor); 806 if (link.head != null) link.head.accept(visitor);
624 } 807 }
625 } 808 }
626 809
810 visitChildren1(Visitor1 visitor, arg) {
811 if (nodes == null) return;
812 for (Link<Node> link = nodes; !link.isEmpty; link = link.tail) {
813 if (link.head != null) link.head.accept1(visitor, arg);
814 }
815 }
816
627 Token getBeginToken() { 817 Token getBeginToken() {
628 if (beginToken != null) return beginToken; 818 if (beginToken != null) return beginToken;
629 if (nodes != null) { 819 if (nodes != null) {
630 for (Link<Node> link = nodes; !link.isEmpty; link = link.tail) { 820 for (Link<Node> link = nodes; !link.isEmpty; link = link.tail) {
631 if (link.head.getBeginToken() != null) { 821 if (link.head.getBeginToken() != null) {
632 return link.head.getBeginToken(); 822 return link.head.getBeginToken();
633 } 823 }
634 if (link.head.getEndToken() != null) { 824 if (link.head.getEndToken() != null) {
635 return link.head.getEndToken(); 825 return link.head.getEndToken();
636 } 826 }
(...skipping 20 matching lines...) Expand all
657 847
658 class Block extends Statement { 848 class Block extends Statement {
659 final NodeList statements; 849 final NodeList statements;
660 850
661 Block(this.statements); 851 Block(this.statements);
662 852
663 Block asBlock() => this; 853 Block asBlock() => this;
664 854
665 accept(Visitor visitor) => visitor.visitBlock(this); 855 accept(Visitor visitor) => visitor.visitBlock(this);
666 856
857 accept1(Visitor1 visitor, arg) => visitor.visitBlock(this, arg);
858
667 visitChildren(Visitor visitor) { 859 visitChildren(Visitor visitor) {
668 if (statements != null) statements.accept(visitor); 860 if (statements != null) statements.accept(visitor);
669 } 861 }
670 862
863 visitChildren1(Visitor1 visitor, arg) {
864 if (statements != null) statements.accept1(visitor, arg);
865 }
866
671 Token getBeginToken() => statements.getBeginToken(); 867 Token getBeginToken() => statements.getBeginToken();
672 868
673 Token getEndToken() => statements.getEndToken(); 869 Token getEndToken() => statements.getEndToken();
674 } 870 }
675 871
676 class If extends Statement { 872 class If extends Statement {
677 final ParenthesizedExpression condition; 873 final ParenthesizedExpression condition;
678 final Statement thenPart; 874 final Statement thenPart;
679 final Statement elsePart; 875 final Statement elsePart;
680 876
681 final Token ifToken; 877 final Token ifToken;
682 final Token elseToken; 878 final Token elseToken;
683 879
684 If(this.condition, this.thenPart, this.elsePart, 880 If(this.condition, this.thenPart, this.elsePart,
685 this.ifToken, this.elseToken); 881 this.ifToken, this.elseToken);
686 882
687 If asIf() => this; 883 If asIf() => this;
688 884
689 bool get hasElsePart => elsePart != null; 885 bool get hasElsePart => elsePart != null;
690 886
691 accept(Visitor visitor) => visitor.visitIf(this); 887 accept(Visitor visitor) => visitor.visitIf(this);
692 888
889 accept1(Visitor1 visitor, arg) => visitor.visitIf(this, arg);
890
693 visitChildren(Visitor visitor) { 891 visitChildren(Visitor visitor) {
694 if (condition != null) condition.accept(visitor); 892 if (condition != null) condition.accept(visitor);
695 if (thenPart != null) thenPart.accept(visitor); 893 if (thenPart != null) thenPart.accept(visitor);
696 if (elsePart != null) elsePart.accept(visitor); 894 if (elsePart != null) elsePart.accept(visitor);
697 } 895 }
698 896
897 visitChildren1(Visitor1 visitor, arg) {
898 if (condition != null) condition.accept1(visitor, arg);
899 if (thenPart != null) thenPart.accept1(visitor, arg);
900 if (elsePart != null) elsePart.accept1(visitor, arg);
901 }
902
699 Token getBeginToken() => ifToken; 903 Token getBeginToken() => ifToken;
700 904
701 Token getEndToken() { 905 Token getEndToken() {
702 if (elsePart == null) return thenPart.getEndToken(); 906 if (elsePart == null) return thenPart.getEndToken();
703 return elsePart.getEndToken(); 907 return elsePart.getEndToken();
704 } 908 }
705 } 909 }
706 910
707 class Conditional extends Expression { 911 class Conditional extends Expression {
708 final Expression condition; 912 final Expression condition;
709 final Expression thenExpression; 913 final Expression thenExpression;
710 final Expression elseExpression; 914 final Expression elseExpression;
711 915
712 final Token questionToken; 916 final Token questionToken;
713 final Token colonToken; 917 final Token colonToken;
714 918
715 Conditional(this.condition, this.thenExpression, 919 Conditional(this.condition, this.thenExpression,
716 this.elseExpression, this.questionToken, this.colonToken); 920 this.elseExpression, this.questionToken, this.colonToken);
717 921
718 Conditional asConditional() => this; 922 Conditional asConditional() => this;
719 923
720 accept(Visitor visitor) => visitor.visitConditional(this); 924 accept(Visitor visitor) => visitor.visitConditional(this);
721 925
926 accept1(Visitor1 visitor, arg) => visitor.visitConditional(this, arg);
927
722 visitChildren(Visitor visitor) { 928 visitChildren(Visitor visitor) {
723 condition.accept(visitor); 929 condition.accept(visitor);
724 thenExpression.accept(visitor); 930 thenExpression.accept(visitor);
725 elseExpression.accept(visitor); 931 elseExpression.accept(visitor);
726 } 932 }
727 933
934 visitChildren1(Visitor1 visitor, arg) {
935 condition.accept1(visitor, arg);
936 thenExpression.accept1(visitor, arg);
937 elseExpression.accept1(visitor, arg);
938 }
939
728 Token getBeginToken() => condition.getBeginToken(); 940 Token getBeginToken() => condition.getBeginToken();
729 941
730 Token getEndToken() => elseExpression.getEndToken(); 942 Token getEndToken() => elseExpression.getEndToken();
731 } 943 }
732 944
733 class For extends Loop { 945 class For extends Loop {
734 /** Either a variable declaration or an expression. */ 946 /** Either a variable declaration or an expression. */
735 final Node initializer; 947 final Node initializer;
736 /** Either an expression statement or an empty statement. */ 948 /** Either an expression statement or an empty statement. */
737 final Statement conditionStatement; 949 final Statement conditionStatement;
(...skipping 11 matching lines...) Expand all
749 conditionStatement.asExpressionStatement(); 961 conditionStatement.asExpressionStatement();
750 if (expressionStatement != null) { 962 if (expressionStatement != null) {
751 return expressionStatement.expression; 963 return expressionStatement.expression;
752 } else { 964 } else {
753 return null; 965 return null;
754 } 966 }
755 } 967 }
756 968
757 accept(Visitor visitor) => visitor.visitFor(this); 969 accept(Visitor visitor) => visitor.visitFor(this);
758 970
971 accept1(Visitor1 visitor, arg) => visitor.visitFor(this, arg);
972
759 visitChildren(Visitor visitor) { 973 visitChildren(Visitor visitor) {
760 if (initializer != null) initializer.accept(visitor); 974 if (initializer != null) initializer.accept(visitor);
761 if (conditionStatement != null) conditionStatement.accept(visitor); 975 if (conditionStatement != null) conditionStatement.accept(visitor);
762 if (update != null) update.accept(visitor); 976 if (update != null) update.accept(visitor);
763 if (body != null) body.accept(visitor); 977 if (body != null) body.accept(visitor);
764 } 978 }
765 979
980 visitChildren1(Visitor1 visitor, arg) {
981 if (initializer != null) initializer.accept1(visitor, arg);
982 if (conditionStatement != null) conditionStatement.accept1(visitor, arg);
983 if (update != null) update.accept1(visitor, arg);
984 if (body != null) body.accept1(visitor, arg);
985 }
986
766 Token getBeginToken() => forToken; 987 Token getBeginToken() => forToken;
767 988
768 Token getEndToken() { 989 Token getEndToken() {
769 return body.getEndToken(); 990 return body.getEndToken();
770 } 991 }
771 } 992 }
772 993
773 class FunctionDeclaration extends Statement { 994 class FunctionDeclaration extends Statement {
774 final FunctionExpression function; 995 final FunctionExpression function;
775 996
776 FunctionDeclaration(this.function); 997 FunctionDeclaration(this.function);
777 998
778 FunctionDeclaration asFunctionDeclaration() => this; 999 FunctionDeclaration asFunctionDeclaration() => this;
779 1000
780 accept(Visitor visitor) => visitor.visitFunctionDeclaration(this); 1001 accept(Visitor visitor) => visitor.visitFunctionDeclaration(this);
781 1002
1003 accept1(Visitor1 visitor, arg) => visitor.visitFunctionDeclaration(this, arg);
1004
782 visitChildren(Visitor visitor) => function.accept(visitor); 1005 visitChildren(Visitor visitor) => function.accept(visitor);
783 1006
1007 visitChildren1(Visitor1 visitor, arg) => function.accept1(visitor, arg);
1008
784 Token getBeginToken() => function.getBeginToken(); 1009 Token getBeginToken() => function.getBeginToken();
785 1010
786 @override 1011 @override
787 Token getPrefixEndToken() => function.getPrefixEndToken(); 1012 Token getPrefixEndToken() => function.getPrefixEndToken();
788 1013
789 Token getEndToken() => function.getEndToken(); 1014 Token getEndToken() => function.getEndToken();
790 } 1015 }
791 1016
792 /// Node representing the method implementation modifiers `sync*`, `async`, and 1017 /// Node representing the method implementation modifiers `sync*`, `async`, and
793 /// `async*` or the invalid modifier `sync`. 1018 /// `async*` or the invalid modifier `sync`.
794 class AsyncModifier extends Node { 1019 class AsyncModifier extends Node {
795 /// The `async` or `sync` token. 1020 /// The `async` or `sync` token.
796 final Token asyncToken; 1021 final Token asyncToken;
797 1022
798 /// The `*` token. 1023 /// The `*` token.
799 final Token starToken; 1024 final Token starToken;
800 1025
801 AsyncModifier(this.asyncToken, this.starToken); 1026 AsyncModifier(this.asyncToken, this.starToken);
802 1027
803 AsyncModifier asAsyncModifier() => this; 1028 AsyncModifier asAsyncModifier() => this;
804 1029
805 accept(Visitor visitor) => visitor.visitAsyncModifier(this); 1030 accept(Visitor visitor) => visitor.visitAsyncModifier(this);
806 1031
1032 accept1(Visitor1 visitor, arg) => visitor.visitAsyncModifier(this, arg);
1033
807 visitChildren(Visitor visitor) {} 1034 visitChildren(Visitor visitor) {}
808 1035
1036 visitChildren1(Visitor1 visitor, arg) {}
1037
809 Token getBeginToken() => asyncToken; 1038 Token getBeginToken() => asyncToken;
810 1039
811 Token getEndToken() => starToken != null ? starToken : asyncToken; 1040 Token getEndToken() => starToken != null ? starToken : asyncToken;
812 1041
813 /// Is `true` if this modifier is either `async` or `async*`. 1042 /// Is `true` if this modifier is either `async` or `async*`.
814 bool get isAsynchronous => asyncToken.value == 'async'; 1043 bool get isAsynchronous => asyncToken.value == 'async';
815 1044
816 /// Is `true` if this modifier is either `sync*` or `async*`. 1045 /// Is `true` if this modifier is either `sync*` or `async*`.
817 bool get isYielding => starToken != null; 1046 bool get isYielding => starToken != null;
818 } 1047 }
(...skipping 19 matching lines...) Expand all
838 FunctionExpression(this.name, this.parameters, this.body, this.returnType, 1067 FunctionExpression(this.name, this.parameters, this.body, this.returnType,
839 this.modifiers, this.initializers, this.getOrSet, 1068 this.modifiers, this.initializers, this.getOrSet,
840 this.asyncModifier) { 1069 this.asyncModifier) {
841 assert(modifiers != null); 1070 assert(modifiers != null);
842 } 1071 }
843 1072
844 FunctionExpression asFunctionExpression() => this; 1073 FunctionExpression asFunctionExpression() => this;
845 1074
846 accept(Visitor visitor) => visitor.visitFunctionExpression(this); 1075 accept(Visitor visitor) => visitor.visitFunctionExpression(this);
847 1076
1077 accept1(Visitor1 visitor, arg) => visitor.visitFunctionExpression(this, arg);
1078
848 bool get isRedirectingFactory { 1079 bool get isRedirectingFactory {
849 return body != null && body.asRedirectingFactoryBody() != null; 1080 return body != null && body.asRedirectingFactoryBody() != null;
850 } 1081 }
851 1082
852 visitChildren(Visitor visitor) { 1083 visitChildren(Visitor visitor) {
853 if (modifiers != null) modifiers.accept(visitor); 1084 if (modifiers != null) modifiers.accept(visitor);
854 if (returnType != null) returnType.accept(visitor); 1085 if (returnType != null) returnType.accept(visitor);
855 if (name != null) name.accept(visitor); 1086 if (name != null) name.accept(visitor);
856 if (parameters != null) parameters.accept(visitor); 1087 if (parameters != null) parameters.accept(visitor);
857 if (initializers != null) initializers.accept(visitor); 1088 if (initializers != null) initializers.accept(visitor);
858 if (asyncModifier != null) asyncModifier.accept(visitor); 1089 if (asyncModifier != null) asyncModifier.accept(visitor);
859 if (body != null) body.accept(visitor); 1090 if (body != null) body.accept(visitor);
860 } 1091 }
861 1092
1093 visitChildren1(Visitor1 visitor, arg) {
1094 if (modifiers != null) modifiers.accept1(visitor, arg);
1095 if (returnType != null) returnType.accept1(visitor, arg);
1096 if (name != null) name.accept1(visitor, arg);
1097 if (parameters != null) parameters.accept1(visitor, arg);
1098 if (initializers != null) initializers.accept1(visitor, arg);
1099 if (asyncModifier != null) asyncModifier.accept1(visitor, arg);
1100 if (body != null) body.accept1(visitor, arg);
1101 }
1102
862 bool get hasBody => body.asEmptyStatement() == null; 1103 bool get hasBody => body.asEmptyStatement() == null;
863 1104
864 bool get hasEmptyBody { 1105 bool get hasEmptyBody {
865 Block block = body.asBlock(); 1106 Block block = body.asBlock();
866 if (block == null) return false; 1107 if (block == null) return false;
867 return block.statements.isEmpty; 1108 return block.statements.isEmpty;
868 } 1109 }
869 1110
870 Token getBeginToken() { 1111 Token getBeginToken() {
871 Token token = firstBeginToken(modifiers, returnType); 1112 Token token = firstBeginToken(modifiers, returnType);
(...skipping 19 matching lines...) Expand all
891 abstract class Literal<T> extends Expression { 1132 abstract class Literal<T> extends Expression {
892 final Token token; 1133 final Token token;
893 final DecodeErrorHandler handler; 1134 final DecodeErrorHandler handler;
894 1135
895 Literal(Token this.token, DecodeErrorHandler this.handler); 1136 Literal(Token this.token, DecodeErrorHandler this.handler);
896 1137
897 T get value; 1138 T get value;
898 1139
899 visitChildren(Visitor visitor) {} 1140 visitChildren(Visitor visitor) {}
900 1141
1142 visitChildren1(Visitor1 visitor, arg) {}
1143
901 Token getBeginToken() => token; 1144 Token getBeginToken() => token;
902 1145
903 Token getEndToken() => token; 1146 Token getEndToken() => token;
904 } 1147 }
905 1148
906 class LiteralInt extends Literal<int> { 1149 class LiteralInt extends Literal<int> {
907 LiteralInt(Token token, DecodeErrorHandler handler) : super(token, handler); 1150 LiteralInt(Token token, DecodeErrorHandler handler) : super(token, handler);
908 1151
909 LiteralInt asLiteralInt() => this; 1152 LiteralInt asLiteralInt() => this;
910 1153
911 int get value { 1154 int get value {
912 try { 1155 try {
913 Token valueToken = token; 1156 Token valueToken = token;
914 if (identical(valueToken.kind, Tokens.PLUS_TOKEN)) { 1157 if (identical(valueToken.kind, Tokens.PLUS_TOKEN)) {
915 valueToken = valueToken.next; 1158 valueToken = valueToken.next;
916 } 1159 }
917 return int.parse(valueToken.value); 1160 return int.parse(valueToken.value);
918 } on FormatException catch (ex) { 1161 } on FormatException catch (ex) {
919 (this.handler)(token, ex); 1162 (this.handler)(token, ex);
920 } 1163 }
921 } 1164 }
922 1165
923 accept(Visitor visitor) => visitor.visitLiteralInt(this); 1166 accept(Visitor visitor) => visitor.visitLiteralInt(this);
1167
1168 accept1(Visitor1 visitor, arg) => visitor.visitLiteralInt(this, arg);
924 } 1169 }
925 1170
926 class LiteralDouble extends Literal<double> { 1171 class LiteralDouble extends Literal<double> {
927 LiteralDouble(Token token, DecodeErrorHandler handler) 1172 LiteralDouble(Token token, DecodeErrorHandler handler)
928 : super(token, handler); 1173 : super(token, handler);
929 1174
930 LiteralDouble asLiteralDouble() => this; 1175 LiteralDouble asLiteralDouble() => this;
931 1176
932 double get value { 1177 double get value {
933 try { 1178 try {
934 Token valueToken = token; 1179 Token valueToken = token;
935 if (identical(valueToken.kind, Tokens.PLUS_TOKEN)) { 1180 if (identical(valueToken.kind, Tokens.PLUS_TOKEN)) {
936 valueToken = valueToken.next; 1181 valueToken = valueToken.next;
937 } 1182 }
938 return double.parse(valueToken.value); 1183 return double.parse(valueToken.value);
939 } on FormatException catch (ex) { 1184 } on FormatException catch (ex) {
940 (this.handler)(token, ex); 1185 (this.handler)(token, ex);
941 } 1186 }
942 } 1187 }
943 1188
944 accept(Visitor visitor) => visitor.visitLiteralDouble(this); 1189 accept(Visitor visitor) => visitor.visitLiteralDouble(this);
1190
1191 accept1(Visitor1 visitor, arg) => visitor.visitLiteralDouble(this, arg);
945 } 1192 }
946 1193
947 class LiteralBool extends Literal<bool> { 1194 class LiteralBool extends Literal<bool> {
948 LiteralBool(Token token, DecodeErrorHandler handler) : super(token, handler); 1195 LiteralBool(Token token, DecodeErrorHandler handler) : super(token, handler);
949 1196
950 LiteralBool asLiteralBool() => this; 1197 LiteralBool asLiteralBool() => this;
951 1198
952 bool get value { 1199 bool get value {
953 if (identical(token.stringValue, 'true')) return true; 1200 if (identical(token.stringValue, 'true')) return true;
954 if (identical(token.stringValue, 'false')) return false; 1201 if (identical(token.stringValue, 'false')) return false;
955 (this.handler)(token, "not a bool ${token.value}"); 1202 (this.handler)(token, "not a bool ${token.value}");
956 throw false; 1203 throw false;
957 } 1204 }
958 1205
959 accept(Visitor visitor) => visitor.visitLiteralBool(this); 1206 accept(Visitor visitor) => visitor.visitLiteralBool(this);
1207
1208 accept1(Visitor1 visitor, arg) => visitor.visitLiteralBool(this, arg);
960 } 1209 }
961 1210
962 1211
963 class StringQuoting { 1212 class StringQuoting {
964 1213
965 /// Cache of common quotings. 1214 /// Cache of common quotings.
966 static const List<StringQuoting> _mapping = const <StringQuoting>[ 1215 static const List<StringQuoting> _mapping = const <StringQuoting>[
967 const StringQuoting($SQ, raw: false, leftQuoteLength: 1), 1216 const StringQuoting($SQ, raw: false, leftQuoteLength: 1),
968 const StringQuoting($SQ, raw: true, leftQuoteLength: 1), 1217 const StringQuoting($SQ, raw: true, leftQuoteLength: 1),
969 const StringQuoting($DQ, raw: false, leftQuoteLength: 1), 1218 const StringQuoting($DQ, raw: false, leftQuoteLength: 1),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 1273
1025 class LiteralString extends StringNode { 1274 class LiteralString extends StringNode {
1026 final Token token; 1275 final Token token;
1027 /** Non-null on validated string literals. */ 1276 /** Non-null on validated string literals. */
1028 final DartString dartString; 1277 final DartString dartString;
1029 1278
1030 LiteralString(this.token, this.dartString); 1279 LiteralString(this.token, this.dartString);
1031 1280
1032 LiteralString asLiteralString() => this; 1281 LiteralString asLiteralString() => this;
1033 1282
1034 void visitChildren(Visitor visitor) {}
1035
1036 bool get isInterpolation => false; 1283 bool get isInterpolation => false;
1037 1284
1038 Token getBeginToken() => token; 1285 Token getBeginToken() => token;
1039 Token getEndToken() => token; 1286 Token getEndToken() => token;
1040 1287
1041 accept(Visitor visitor) => visitor.visitLiteralString(this); 1288 accept(Visitor visitor) => visitor.visitLiteralString(this);
1289
1290 accept1(Visitor1 visitor, arg) => visitor.visitLiteralString(this, arg);
1291
1292 void visitChildren(Visitor visitor) {}
1293
1294 void visitChildren1(Visitor1 visitor, arg) {}
1042 } 1295 }
1043 1296
1044 class LiteralNull extends Literal<String> { 1297 class LiteralNull extends Literal<String> {
1045 LiteralNull(Token token) : super(token, null); 1298 LiteralNull(Token token) : super(token, null);
1046 1299
1047 LiteralNull asLiteralNull() => this; 1300 LiteralNull asLiteralNull() => this;
1048 1301
1049 String get value => null; 1302 String get value => null;
1050 1303
1051 accept(Visitor visitor) => visitor.visitLiteralNull(this); 1304 accept(Visitor visitor) => visitor.visitLiteralNull(this);
1305
1306 accept1(Visitor1 visitor, arg) => visitor.visitLiteralNull(this, arg);
1052 } 1307 }
1053 1308
1054 class LiteralList extends Expression { 1309 class LiteralList extends Expression {
1055 final NodeList typeArguments; 1310 final NodeList typeArguments;
1056 final NodeList elements; 1311 final NodeList elements;
1057 1312
1058 final Token constKeyword; 1313 final Token constKeyword;
1059 1314
1060 LiteralList(this.typeArguments, this.elements, this.constKeyword); 1315 LiteralList(this.typeArguments, this.elements, this.constKeyword);
1061 1316
1062 bool get isConst => constKeyword != null; 1317 bool get isConst => constKeyword != null;
1063 1318
1064 LiteralList asLiteralList() => this; 1319 LiteralList asLiteralList() => this;
1065 accept(Visitor visitor) => visitor.visitLiteralList(this); 1320 accept(Visitor visitor) => visitor.visitLiteralList(this);
1066 1321
1322 accept1(Visitor1 visitor, arg) => visitor.visitLiteralList(this, arg);
1323
1067 visitChildren(Visitor visitor) { 1324 visitChildren(Visitor visitor) {
1068 if (typeArguments != null) typeArguments.accept(visitor); 1325 if (typeArguments != null) typeArguments.accept(visitor);
1069 elements.accept(visitor); 1326 elements.accept(visitor);
1070 } 1327 }
1071 1328
1329 visitChildren1(Visitor1 visitor, arg) {
1330 if (typeArguments != null) typeArguments.accept1(visitor, arg);
1331 elements.accept1(visitor, arg);
1332 }
1333
1072 Token getBeginToken() { 1334 Token getBeginToken() {
1073 if (constKeyword != null) return constKeyword; 1335 if (constKeyword != null) return constKeyword;
1074 return firstBeginToken(typeArguments, elements); 1336 return firstBeginToken(typeArguments, elements);
1075 } 1337 }
1076 1338
1077 Token getEndToken() => elements.getEndToken(); 1339 Token getEndToken() => elements.getEndToken();
1078 } 1340 }
1079 1341
1080 class LiteralSymbol extends Expression { 1342 class LiteralSymbol extends Expression {
1081 final Token hashToken; 1343 final Token hashToken;
1082 // TODO: this could be a DottedNamed. 1344 // TODO: this could be a DottedNamed.
1083 final NodeList identifiers; 1345 final NodeList identifiers;
1084 1346
1085 LiteralSymbol(this.hashToken, this.identifiers); 1347 LiteralSymbol(this.hashToken, this.identifiers);
1086 1348
1087 LiteralSymbol asLiteralSymbol() => this; 1349 LiteralSymbol asLiteralSymbol() => this;
1088 1350
1351 accept(Visitor visitor) => visitor.visitLiteralSymbol(this);
1352
1353 accept1(Visitor1 visitor, arg) => visitor.visitLiteralSymbol(this, arg);
1354
1089 void visitChildren(Visitor visitor) { 1355 void visitChildren(Visitor visitor) {
1090 if (identifiers != null) identifiers.accept(visitor); 1356 if (identifiers != null) identifiers.accept(visitor);
1091 } 1357 }
1092 1358
1093 accept(Visitor visitor) => visitor.visitLiteralSymbol(this); 1359 void visitChildren1(Visitor1 visitor, arg) {
1360 if (identifiers != null) identifiers.accept1(visitor, arg);
1361 }
1094 1362
1095 Token getBeginToken() => hashToken; 1363 Token getBeginToken() => hashToken;
1096 1364
1097 Token getEndToken() => identifiers.getEndToken(); 1365 Token getEndToken() => identifiers.getEndToken();
1098 1366
1099 String get slowNameString { 1367 String get slowNameString {
1100 Unparser unparser = new Unparser(); 1368 Unparser unparser = new Unparser();
1101 unparser.unparseNodeListOfIdentifiers(identifiers); 1369 unparser.unparseNodeListOfIdentifiers(identifiers);
1102 return unparser.result; 1370 return unparser.result;
1103 } 1371 }
1104 } 1372 }
1105 1373
1106 class Identifier extends Expression with StoredTreeElementMixin { 1374 class Identifier extends Expression with StoredTreeElementMixin {
1107 final Token token; 1375 final Token token;
1108 1376
1109 String get source => token.value; 1377 String get source => token.value;
1110 1378
1111 Identifier(Token this.token); 1379 Identifier(Token this.token);
1112 1380
1113 bool isThis() => identical(source, 'this'); 1381 bool isThis() => identical(source, 'this');
1114 1382
1115 bool isSuper() => identical(source, 'super'); 1383 bool isSuper() => identical(source, 'super');
1116 1384
1117 Identifier asIdentifier() => this; 1385 Identifier asIdentifier() => this;
1118 1386
1119 accept(Visitor visitor) => visitor.visitIdentifier(this); 1387 accept(Visitor visitor) => visitor.visitIdentifier(this);
1120 1388
1389 accept1(Visitor1 visitor, arg) => visitor.visitIdentifier(this, arg);
1390
1121 visitChildren(Visitor visitor) {} 1391 visitChildren(Visitor visitor) {}
1122 1392
1393 visitChildren1(Visitor1 visitor, arg) {}
1394
1123 Token getBeginToken() => token; 1395 Token getBeginToken() => token;
1124 1396
1125 Token getEndToken() => token; 1397 Token getEndToken() => token;
1126 } 1398 }
1127 1399
1128 // TODO(floitsch): a dotted identifier isn't really an expression. Should it 1400 // TODO(floitsch): a dotted identifier isn't really an expression. Should it
1129 // inherit from Node instead? 1401 // inherit from Node instead?
1130 class DottedName extends Expression { 1402 class DottedName extends Expression {
1131 final Token token; 1403 final Token token;
1132 final NodeList identifiers; 1404 final NodeList identifiers;
1133 1405
1134 DottedName(this.token, this.identifiers); 1406 DottedName(this.token, this.identifiers);
1135 1407
1136 DottedName asDottedName() => this; 1408 DottedName asDottedName() => this;
1137 1409
1410 accept(Visitor visitor) => visitor.visitDottedName(this);
1411
1412 accept1(Visitor1 visitor, arg) => visitor.visitDottedName(this, arg);
1413
1138 void visitChildren(Visitor visitor) { 1414 void visitChildren(Visitor visitor) {
1139 identifiers.accept(visitor); 1415 identifiers.accept(visitor);
1140 } 1416 }
1141 1417
1142 accept(Visitor visitor) => visitor.visitDottedName(this); 1418 void visitChildren1(Visitor1 visitor, arg) {
1419 identifiers.accept1(visitor, arg);
1420 }
1143 1421
1144 Token getBeginToken() => token; 1422 Token getBeginToken() => token;
1145 Token getEndToken() => identifiers.getEndToken(); 1423 Token getEndToken() => identifiers.getEndToken();
1146 1424
1147 String get slowNameString { 1425 String get slowNameString {
1148 Unparser unparser = new Unparser(); 1426 Unparser unparser = new Unparser();
1149 unparser.unparseNodeListOfIdentifiers(identifiers); 1427 unparser.unparseNodeListOfIdentifiers(identifiers);
1150 return unparser.result; 1428 return unparser.result;
1151 } 1429 }
1152 } 1430 }
1153 1431
1154 class Operator extends Identifier { 1432 class Operator extends Identifier {
1155 static const COMPLEX_OPERATORS = 1433 static const COMPLEX_OPERATORS =
1156 const ["--", "++", '+=', "-=", "*=", "/=", "%=", "&=", "|=", "~/=", "^=", 1434 const ["--", "++", '+=', "-=", "*=", "/=", "%=", "&=", "|=", "~/=", "^=",
1157 ">>=", "<<=", "??="]; 1435 ">>=", "<<=", "??="];
1158 1436
1159 static const INCREMENT_OPERATORS = const <String>["++", "--"]; 1437 static const INCREMENT_OPERATORS = const <String>["++", "--"];
1160 1438
1161 Operator(Token token) : super(token); 1439 Operator(Token token) : super(token);
1162 1440
1163 Operator asOperator() => this; 1441 Operator asOperator() => this;
1164 1442
1165 accept(Visitor visitor) => visitor.visitOperator(this); 1443 accept(Visitor visitor) => visitor.visitOperator(this);
1444
1445 accept1(Visitor1 visitor, arg) => visitor.visitOperator(this, arg);
1166 } 1446 }
1167 1447
1168 class Return extends Statement { 1448 class Return extends Statement {
1169 final Node expression; 1449 final Node expression;
1170 final Token beginToken; 1450 final Token beginToken;
1171 final Token endToken; 1451 final Token endToken;
1172 1452
1173 Return(this.beginToken, this.endToken, this.expression); 1453 Return(this.beginToken, this.endToken, this.expression);
1174 1454
1175 Return asReturn() => this; 1455 Return asReturn() => this;
1176 1456
1177 bool get hasExpression => expression != null; 1457 bool get hasExpression => expression != null;
1178 1458
1179 /// `true` if this return is of the form `=> e;`. 1459 /// `true` if this return is of the form `=> e;`.
1180 bool get isArrowBody => beginToken.info == Precedence.FUNCTION_INFO; 1460 bool get isArrowBody => beginToken.info == Precedence.FUNCTION_INFO;
1181 1461
1182 accept(Visitor visitor) => visitor.visitReturn(this); 1462 accept(Visitor visitor) => visitor.visitReturn(this);
1183 1463
1464 accept1(Visitor1 visitor, arg) => visitor.visitReturn(this, arg);
1465
1184 visitChildren(Visitor visitor) { 1466 visitChildren(Visitor visitor) {
1185 if (expression != null) expression.accept(visitor); 1467 if (expression != null) expression.accept(visitor);
1186 } 1468 }
1187 1469
1470 visitChildren1(Visitor1 visitor, arg) {
1471 if (expression != null) expression.accept1(visitor, arg);
1472 }
1473
1188 Token getBeginToken() => beginToken; 1474 Token getBeginToken() => beginToken;
1189 1475
1190 Token getEndToken() { 1476 Token getEndToken() {
1191 if (endToken == null) return expression.getEndToken(); 1477 if (endToken == null) return expression.getEndToken();
1192 return endToken; 1478 return endToken;
1193 } 1479 }
1194 } 1480 }
1195 1481
1196 class Yield extends Statement { 1482 class Yield extends Statement {
1197 final Node expression; 1483 final Node expression;
1198 final Token yieldToken; 1484 final Token yieldToken;
1199 final Token starToken; 1485 final Token starToken;
1200 final Token endToken; 1486 final Token endToken;
1201 1487
1202 Yield(this.yieldToken, this.starToken, this.expression, this.endToken); 1488 Yield(this.yieldToken, this.starToken, this.expression, this.endToken);
1203 1489
1204 Yield asYield() => this; 1490 Yield asYield() => this;
1205 1491
1206 bool get hasStar => starToken != null; 1492 bool get hasStar => starToken != null;
1207 1493
1208 accept(Visitor visitor) => visitor.visitYield(this); 1494 accept(Visitor visitor) => visitor.visitYield(this);
1209 1495
1496 accept1(Visitor1 visitor, arg) => visitor.visitYield(this, arg);
1497
1210 visitChildren(Visitor visitor) { 1498 visitChildren(Visitor visitor) {
1211 expression.accept(visitor); 1499 expression.accept(visitor);
1212 } 1500 }
1213 1501
1502 visitChildren1(Visitor1 visitor, arg) {
1503 expression.accept1(visitor, arg);
1504 }
1505
1214 Token getBeginToken() => yieldToken; 1506 Token getBeginToken() => yieldToken;
1215 1507
1216 Token getEndToken() => endToken; 1508 Token getEndToken() => endToken;
1217 } 1509 }
1218 1510
1219 class RedirectingFactoryBody extends Statement with StoredTreeElementMixin { 1511 class RedirectingFactoryBody extends Statement with StoredTreeElementMixin {
1220 final Node constructorReference; 1512 final Node constructorReference;
1221 final Token beginToken; 1513 final Token beginToken;
1222 final Token endToken; 1514 final Token endToken;
1223 1515
1224 RedirectingFactoryBody(this.beginToken, this.endToken, 1516 RedirectingFactoryBody(this.beginToken, this.endToken,
1225 this.constructorReference); 1517 this.constructorReference);
1226 1518
1227 RedirectingFactoryBody asRedirectingFactoryBody() => this; 1519 RedirectingFactoryBody asRedirectingFactoryBody() => this;
1228 1520
1229 accept(Visitor visitor) => visitor.visitRedirectingFactoryBody(this); 1521 accept(Visitor visitor) => visitor.visitRedirectingFactoryBody(this);
1230 1522
1523 accept1(Visitor1 visitor, arg) {
1524 return visitor.visitRedirectingFactoryBody(this, arg);
1525 }
1526
1231 visitChildren(Visitor visitor) { 1527 visitChildren(Visitor visitor) {
1232 constructorReference.accept(visitor); 1528 constructorReference.accept(visitor);
1233 } 1529 }
1234 1530
1531 visitChildren1(Visitor1 visitor, arg) {
1532 constructorReference.accept1(visitor, arg);
1533 }
1534
1235 Token getBeginToken() => beginToken; 1535 Token getBeginToken() => beginToken;
1236 1536
1237 Token getEndToken() => endToken; 1537 Token getEndToken() => endToken;
1238 } 1538 }
1239 1539
1240 class ExpressionStatement extends Statement { 1540 class ExpressionStatement extends Statement {
1241 final Expression expression; 1541 final Expression expression;
1242 final Token endToken; 1542 final Token endToken;
1243 1543
1244 ExpressionStatement(this.expression, this.endToken); 1544 ExpressionStatement(this.expression, this.endToken);
1245 1545
1246 ExpressionStatement asExpressionStatement() => this; 1546 ExpressionStatement asExpressionStatement() => this;
1247 1547
1248 accept(Visitor visitor) => visitor.visitExpressionStatement(this); 1548 accept(Visitor visitor) => visitor.visitExpressionStatement(this);
1249 1549
1550 accept1(Visitor1 visitor, arg) => visitor.visitExpressionStatement(this, arg);
1551
1250 visitChildren(Visitor visitor) { 1552 visitChildren(Visitor visitor) {
1251 if (expression != null) expression.accept(visitor); 1553 if (expression != null) expression.accept(visitor);
1252 } 1554 }
1253 1555
1556 visitChildren1(Visitor1 visitor, arg) {
1557 if (expression != null) expression.accept1(visitor, arg);
1558 }
1559
1254 Token getBeginToken() => expression.getBeginToken(); 1560 Token getBeginToken() => expression.getBeginToken();
1255 1561
1256 Token getEndToken() => endToken; 1562 Token getEndToken() => endToken;
1257 } 1563 }
1258 1564
1259 class Throw extends Expression { 1565 class Throw extends Expression {
1260 final Expression expression; 1566 final Expression expression;
1261 1567
1262 final Token throwToken; 1568 final Token throwToken;
1263 final Token endToken; 1569 final Token endToken;
1264 1570
1265 Throw(this.expression, this.throwToken, this.endToken); 1571 Throw(this.expression, this.throwToken, this.endToken);
1266 1572
1267 Throw asThrow() => this; 1573 Throw asThrow() => this;
1268 1574
1269 accept(Visitor visitor) => visitor.visitThrow(this); 1575 accept(Visitor visitor) => visitor.visitThrow(this);
1270 1576
1577 accept1(Visitor1 visitor, arg) => visitor.visitThrow(this, arg);
1578
1271 visitChildren(Visitor visitor) { 1579 visitChildren(Visitor visitor) {
1272 expression.accept(visitor); 1580 expression.accept(visitor);
1273 } 1581 }
1274 1582
1583 visitChildren1(Visitor1 visitor, arg) {
1584 expression.accept1(visitor, arg);
1585 }
1586
1275 Token getBeginToken() => throwToken; 1587 Token getBeginToken() => throwToken;
1276 1588
1277 Token getEndToken() => endToken; 1589 Token getEndToken() => endToken;
1278 } 1590 }
1279 1591
1280 class Await extends Expression { 1592 class Await extends Expression {
1281 final Expression expression; 1593 final Expression expression;
1282 1594
1283 final Token awaitToken; 1595 final Token awaitToken;
1284 1596
1285 Await(this.awaitToken, this.expression); 1597 Await(this.awaitToken, this.expression);
1286 1598
1287 Await asAwait() => this; 1599 Await asAwait() => this;
1288 1600
1289 accept(Visitor visitor) => visitor.visitAwait(this); 1601 accept(Visitor visitor) => visitor.visitAwait(this);
1290 1602
1603 accept1(Visitor1 visitor, arg) => visitor.visitAwait(this, arg);
1604
1291 visitChildren(Visitor visitor) { 1605 visitChildren(Visitor visitor) {
1292 expression.accept(visitor); 1606 expression.accept(visitor);
1293 } 1607 }
1294 1608
1609 visitChildren1(Visitor1 visitor, arg) {
1610 expression.accept1(visitor, arg);
1611 }
1612
1295 Token getBeginToken() => awaitToken; 1613 Token getBeginToken() => awaitToken;
1296 1614
1297 Token getEndToken() => expression.getEndToken(); 1615 Token getEndToken() => expression.getEndToken();
1298 } 1616 }
1299 1617
1300 class Assert extends Statement { 1618 class Assert extends Statement {
1301 final Token assertToken; 1619 final Token assertToken;
1302 final Expression condition; 1620 final Expression condition;
1303 /** Message may be `null`. */ 1621 /** Message may be `null`. */
1304 final Expression message; 1622 final Expression message;
1305 final Token semicolonToken; 1623 final Token semicolonToken;
1306 1624
1307 Assert(this.assertToken, this.condition, this.message, this.semicolonToken); 1625 Assert(this.assertToken, this.condition, this.message, this.semicolonToken);
1308 1626
1309 Assert asAssert() => this; 1627 Assert asAssert() => this;
1310 1628
1311 bool get hasMessage => message != null; 1629 bool get hasMessage => message != null;
1312 1630
1313 accept(Visitor visitor) => visitor.visitAssert(this); 1631 accept(Visitor visitor) => visitor.visitAssert(this);
1314 1632
1633 accept1(Visitor1 visitor, arg) => visitor.visitAssert(this, arg);
1634
1315 visitChildren(Visitor visitor) { 1635 visitChildren(Visitor visitor) {
1316 condition.accept(visitor); 1636 condition.accept(visitor);
1317 if (message != null) message.accept(visitor); 1637 if (message != null) message.accept(visitor);
1318 } 1638 }
1319 1639
1640 visitChildren1(Visitor1 visitor, arg) {
1641 condition.accept1(visitor, arg);
1642 if (message != null) message.accept1(visitor, arg);
1643 }
1644
1320 Token getBeginToken() => assertToken; 1645 Token getBeginToken() => assertToken;
1321 Token getEndToken() => semicolonToken; 1646 Token getEndToken() => semicolonToken;
1322 } 1647 }
1323 1648
1324 class Rethrow extends Statement { 1649 class Rethrow extends Statement {
1325 final Token throwToken; 1650 final Token throwToken;
1326 final Token endToken; 1651 final Token endToken;
1327 1652
1328 Rethrow(this.throwToken, this.endToken); 1653 Rethrow(this.throwToken, this.endToken);
1329 1654
1330 Rethrow asRethrow() => this; 1655 Rethrow asRethrow() => this;
1331 1656
1332 accept(Visitor visitor) => visitor.visitRethrow(this); 1657 accept(Visitor visitor) => visitor.visitRethrow(this);
1658
1659 accept1(Visitor1 visitor, arg) => visitor.visitRethrow(this, arg);
1660
1333 visitChildren(Visitor visitor) { } 1661 visitChildren(Visitor visitor) { }
1334 1662
1663 visitChildren1(Visitor1 visitor, arg) { }
1664
1335 Token getBeginToken() => throwToken; 1665 Token getBeginToken() => throwToken;
1336 Token getEndToken() => endToken; 1666 Token getEndToken() => endToken;
1337 } 1667 }
1338 1668
1339 class TypeAnnotation extends Node { 1669 class TypeAnnotation extends Node {
1340 final Expression typeName; 1670 final Expression typeName;
1341 final NodeList typeArguments; 1671 final NodeList typeArguments;
1342 1672
1343 TypeAnnotation(Expression this.typeName, NodeList this.typeArguments); 1673 TypeAnnotation(Expression this.typeName, NodeList this.typeArguments);
1344 1674
1345 TypeAnnotation asTypeAnnotation() => this; 1675 TypeAnnotation asTypeAnnotation() => this;
1346 1676
1347 accept(Visitor visitor) => visitor.visitTypeAnnotation(this); 1677 accept(Visitor visitor) => visitor.visitTypeAnnotation(this);
1348 1678
1679 accept1(Visitor1 visitor, arg) => visitor.visitTypeAnnotation(this, arg);
1680
1349 visitChildren(Visitor visitor) { 1681 visitChildren(Visitor visitor) {
1350 typeName.accept(visitor); 1682 typeName.accept(visitor);
1351 if (typeArguments != null) typeArguments.accept(visitor); 1683 if (typeArguments != null) typeArguments.accept(visitor);
1352 } 1684 }
1353 1685
1686 visitChildren1(Visitor1 visitor, arg) {
1687 typeName.accept1(visitor, arg);
1688 if (typeArguments != null) typeArguments.accept1(visitor, arg);
1689 }
1690
1354 Token getBeginToken() => typeName.getBeginToken(); 1691 Token getBeginToken() => typeName.getBeginToken();
1355 1692
1356 Token getEndToken() { 1693 Token getEndToken() {
1357 if (typeArguments != null) return typeArguments.getEndToken(); 1694 if (typeArguments != null) return typeArguments.getEndToken();
1358 return typeName.getEndToken(); 1695 return typeName.getEndToken();
1359 } 1696 }
1360 } 1697 }
1361 1698
1362 class TypeVariable extends Node { 1699 class TypeVariable extends Node {
1363 final Identifier name; 1700 final Identifier name;
1364 final TypeAnnotation bound; 1701 final TypeAnnotation bound;
1365 TypeVariable(Identifier this.name, TypeAnnotation this.bound); 1702 TypeVariable(Identifier this.name, TypeAnnotation this.bound);
1366 1703
1367 accept(Visitor visitor) => visitor.visitTypeVariable(this); 1704 accept(Visitor visitor) => visitor.visitTypeVariable(this);
1368 1705
1706 accept1(Visitor1 visitor, arg) => visitor.visitTypeVariable(this, arg);
1707
1369 visitChildren(Visitor visitor) { 1708 visitChildren(Visitor visitor) {
1370 name.accept(visitor); 1709 name.accept(visitor);
1371 if (bound != null) { 1710 if (bound != null) {
1372 bound.accept(visitor); 1711 bound.accept(visitor);
1373 } 1712 }
1374 } 1713 }
1375 1714
1715 visitChildren1(Visitor1 visitor, arg) {
1716 name.accept1(visitor, arg);
1717 if (bound != null) {
1718 bound.accept1(visitor, arg);
1719 }
1720 }
1721
1376 TypeVariable asTypeVariable() => this; 1722 TypeVariable asTypeVariable() => this;
1377 1723
1378 Token getBeginToken() => name.getBeginToken(); 1724 Token getBeginToken() => name.getBeginToken();
1379 1725
1380 Token getEndToken() { 1726 Token getEndToken() {
1381 return (bound != null) ? bound.getEndToken() : name.getEndToken(); 1727 return (bound != null) ? bound.getEndToken() : name.getEndToken();
1382 } 1728 }
1383 } 1729 }
1384 1730
1385 class VariableDefinitions extends Statement { 1731 class VariableDefinitions extends Statement {
(...skipping 14 matching lines...) Expand all
1400 this.type, 1746 this.type,
1401 this.modifiers, 1747 this.modifiers,
1402 this.definitions) { 1748 this.definitions) {
1403 assert(modifiers != null); 1749 assert(modifiers != null);
1404 } 1750 }
1405 1751
1406 VariableDefinitions asVariableDefinitions() => this; 1752 VariableDefinitions asVariableDefinitions() => this;
1407 1753
1408 accept(Visitor visitor) => visitor.visitVariableDefinitions(this); 1754 accept(Visitor visitor) => visitor.visitVariableDefinitions(this);
1409 1755
1756 accept1(Visitor1 visitor, arg) => visitor.visitVariableDefinitions(this, arg);
1757
1410 visitChildren(Visitor visitor) { 1758 visitChildren(Visitor visitor) {
1411 if (metadata != null) metadata.accept(visitor); 1759 if (metadata != null) metadata.accept(visitor);
1412 if (type != null) type.accept(visitor); 1760 if (type != null) type.accept(visitor);
1413 if (definitions != null) definitions.accept(visitor); 1761 if (definitions != null) definitions.accept(visitor);
1414 } 1762 }
1415 1763
1764 visitChildren1(Visitor1 visitor, arg) {
1765 if (metadata != null) metadata.accept1(visitor, arg);
1766 if (type != null) type.accept1(visitor, arg);
1767 if (definitions != null) definitions.accept1(visitor, arg);
1768 }
1769
1416 Token getBeginToken() { 1770 Token getBeginToken() {
1417 var token = firstBeginToken(modifiers, type); 1771 var token = firstBeginToken(modifiers, type);
1418 if (token == null) { 1772 if (token == null) {
1419 token = definitions.getBeginToken(); 1773 token = definitions.getBeginToken();
1420 } 1774 }
1421 return token; 1775 return token;
1422 } 1776 }
1423 1777
1424 Token getEndToken() => definitions.getEndToken(); 1778 Token getEndToken() => definitions.getEndToken();
1425 } 1779 }
(...skipping 15 matching lines...) Expand all
1441 final Expression condition; 1795 final Expression condition;
1442 1796
1443 DoWhile(Statement body, Expression this.condition, 1797 DoWhile(Statement body, Expression this.condition,
1444 Token this.doKeyword, Token this.whileKeyword, Token this.endToken) 1798 Token this.doKeyword, Token this.whileKeyword, Token this.endToken)
1445 : super(body); 1799 : super(body);
1446 1800
1447 DoWhile asDoWhile() => this; 1801 DoWhile asDoWhile() => this;
1448 1802
1449 accept(Visitor visitor) => visitor.visitDoWhile(this); 1803 accept(Visitor visitor) => visitor.visitDoWhile(this);
1450 1804
1805 accept1(Visitor1 visitor, arg) => visitor.visitDoWhile(this, arg);
1806
1451 visitChildren(Visitor visitor) { 1807 visitChildren(Visitor visitor) {
1452 if (condition != null) condition.accept(visitor); 1808 if (condition != null) condition.accept(visitor);
1453 if (body != null) body.accept(visitor); 1809 if (body != null) body.accept(visitor);
1454 } 1810 }
1455 1811
1812 visitChildren1(Visitor1 visitor, arg) {
1813 if (condition != null) condition.accept1(visitor, arg);
1814 if (body != null) body.accept1(visitor, arg);
1815 }
1816
1456 Token getBeginToken() => doKeyword; 1817 Token getBeginToken() => doKeyword;
1457 1818
1458 Token getEndToken() => endToken; 1819 Token getEndToken() => endToken;
1459 } 1820 }
1460 1821
1461 class While extends Loop { 1822 class While extends Loop {
1462 final Token whileKeyword; 1823 final Token whileKeyword;
1463 final Expression condition; 1824 final Expression condition;
1464 1825
1465 While(Expression this.condition, Statement body, 1826 While(Expression this.condition, Statement body,
1466 Token this.whileKeyword) : super(body); 1827 Token this.whileKeyword) : super(body);
1467 1828
1468 While asWhile() => this; 1829 While asWhile() => this;
1469 1830
1470 accept(Visitor visitor) => visitor.visitWhile(this); 1831 accept(Visitor visitor) => visitor.visitWhile(this);
1471 1832
1833 accept1(Visitor1 visitor, arg) => visitor.visitWhile(this, arg);
1834
1472 visitChildren(Visitor visitor) { 1835 visitChildren(Visitor visitor) {
1473 if (condition != null) condition.accept(visitor); 1836 if (condition != null) condition.accept(visitor);
1474 if (body != null) body.accept(visitor); 1837 if (body != null) body.accept(visitor);
1475 } 1838 }
1476 1839
1840 visitChildren1(Visitor1 visitor, arg) {
1841 if (condition != null) condition.accept1(visitor, arg);
1842 if (body != null) body.accept1(visitor, arg);
1843 }
1844
1477 Token getBeginToken() => whileKeyword; 1845 Token getBeginToken() => whileKeyword;
1478 1846
1479 Token getEndToken() => body.getEndToken(); 1847 Token getEndToken() => body.getEndToken();
1480 } 1848 }
1481 1849
1482 class ParenthesizedExpression extends Expression { 1850 class ParenthesizedExpression extends Expression {
1483 final Expression expression; 1851 final Expression expression;
1484 final BeginGroupToken beginToken; 1852 final BeginGroupToken beginToken;
1485 1853
1486 ParenthesizedExpression(Expression this.expression, 1854 ParenthesizedExpression(Expression this.expression,
1487 BeginGroupToken this.beginToken); 1855 BeginGroupToken this.beginToken);
1488 1856
1489 ParenthesizedExpression asParenthesizedExpression() => this; 1857 ParenthesizedExpression asParenthesizedExpression() => this;
1490 1858
1491 accept(Visitor visitor) => visitor.visitParenthesizedExpression(this); 1859 accept(Visitor visitor) => visitor.visitParenthesizedExpression(this);
1492 1860
1861 accept1(Visitor1 visitor, arg) {
1862 return visitor.visitParenthesizedExpression(this, arg);
1863 }
1864
1493 visitChildren(Visitor visitor) { 1865 visitChildren(Visitor visitor) {
1494 if (expression != null) expression.accept(visitor); 1866 if (expression != null) expression.accept(visitor);
1495 } 1867 }
1496 1868
1869 visitChildren1(Visitor1 visitor, arg) {
1870 if (expression != null) expression.accept1(visitor, arg);
1871 }
1872
1497 Token getBeginToken() => beginToken; 1873 Token getBeginToken() => beginToken;
1498 1874
1499 Token getEndToken() => beginToken.endGroup; 1875 Token getEndToken() => beginToken.endGroup;
1500 } 1876 }
1501 1877
1502 /** Representation of modifiers such as static, abstract, final, etc. */ 1878 /** Representation of modifiers such as static, abstract, final, etc. */
1503 class Modifiers extends Node { 1879 class Modifiers extends Node {
1504 /** 1880 /**
1505 * Pseudo-constant for empty modifiers. 1881 * Pseudo-constant for empty modifiers.
1506 */ 1882 */
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 if(identical(value, modifier)) { 1928 if(identical(value, modifier)) {
1553 return nodeList.head; 1929 return nodeList.head;
1554 } 1930 }
1555 } 1931 }
1556 return null; 1932 return null;
1557 } 1933 }
1558 1934
1559 Modifiers asModifiers() => this; 1935 Modifiers asModifiers() => this;
1560 Token getBeginToken() => nodes.getBeginToken(); 1936 Token getBeginToken() => nodes.getBeginToken();
1561 Token getEndToken() => nodes.getEndToken(); 1937 Token getEndToken() => nodes.getEndToken();
1938
1562 accept(Visitor visitor) => visitor.visitModifiers(this); 1939 accept(Visitor visitor) => visitor.visitModifiers(this);
1940
1941 accept1(Visitor1 visitor, arg) => visitor.visitModifiers(this, arg);
1942
1563 visitChildren(Visitor visitor) => nodes.accept(visitor); 1943 visitChildren(Visitor visitor) => nodes.accept(visitor);
1564 1944
1945 visitChildren1(Visitor1 visitor, arg) => nodes.accept1(visitor, arg);
1946
1565 bool get isStatic => (flags & FLAG_STATIC) != 0; 1947 bool get isStatic => (flags & FLAG_STATIC) != 0;
1566 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0; 1948 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0;
1567 bool get isFinal => (flags & FLAG_FINAL) != 0; 1949 bool get isFinal => (flags & FLAG_FINAL) != 0;
1568 bool get isVar => (flags & FLAG_VAR) != 0; 1950 bool get isVar => (flags & FLAG_VAR) != 0;
1569 bool get isConst => (flags & FLAG_CONST) != 0; 1951 bool get isConst => (flags & FLAG_CONST) != 0;
1570 bool get isFactory => (flags & FLAG_FACTORY) != 0; 1952 bool get isFactory => (flags & FLAG_FACTORY) != 0;
1571 bool get isExternal => (flags & FLAG_EXTERNAL) != 0; 1953 bool get isExternal => (flags & FLAG_EXTERNAL) != 0;
1572 1954
1573 Node getStatic() => findModifier('static'); 1955 Node getStatic() => findModifier('static');
1574 1956
(...skipping 20 matching lines...) Expand all
1595 1977
1596 StringInterpolation(this.string, this.parts); 1978 StringInterpolation(this.string, this.parts);
1597 1979
1598 StringInterpolation asStringInterpolation() => this; 1980 StringInterpolation asStringInterpolation() => this;
1599 1981
1600 DartString get dartString => null; 1982 DartString get dartString => null;
1601 bool get isInterpolation => true; 1983 bool get isInterpolation => true;
1602 1984
1603 accept(Visitor visitor) => visitor.visitStringInterpolation(this); 1985 accept(Visitor visitor) => visitor.visitStringInterpolation(this);
1604 1986
1987 accept1(Visitor1 visitor, arg) => visitor.visitStringInterpolation(this, arg);
1988
1605 visitChildren(Visitor visitor) { 1989 visitChildren(Visitor visitor) {
1606 string.accept(visitor); 1990 string.accept(visitor);
1607 parts.accept(visitor); 1991 parts.accept(visitor);
1608 } 1992 }
1609 1993
1994 visitChildren1(Visitor1 visitor, arg) {
1995 string.accept1(visitor, arg);
1996 parts.accept1(visitor, arg);
1997 }
1998
1610 Token getBeginToken() => string.getBeginToken(); 1999 Token getBeginToken() => string.getBeginToken();
1611 Token getEndToken() => parts.getEndToken(); 2000 Token getEndToken() => parts.getEndToken();
1612 } 2001 }
1613 2002
1614 class StringInterpolationPart extends Node { 2003 class StringInterpolationPart extends Node {
1615 final Expression expression; 2004 final Expression expression;
1616 final LiteralString string; 2005 final LiteralString string;
1617 2006
1618 StringInterpolationPart(this.expression, this.string); 2007 StringInterpolationPart(this.expression, this.string);
1619 2008
1620 StringInterpolationPart asStringInterpolationPart() => this; 2009 StringInterpolationPart asStringInterpolationPart() => this;
1621 2010
1622 accept(Visitor visitor) => visitor.visitStringInterpolationPart(this); 2011 accept(Visitor visitor) => visitor.visitStringInterpolationPart(this);
1623 2012
2013 accept1(Visitor1 visitor, arg) {
2014 return visitor.visitStringInterpolationPart(this, arg);
2015 }
2016
1624 visitChildren(Visitor visitor) { 2017 visitChildren(Visitor visitor) {
1625 expression.accept(visitor); 2018 expression.accept(visitor);
1626 string.accept(visitor); 2019 string.accept(visitor);
1627 } 2020 }
1628 2021
2022 visitChildren1(Visitor1 visitor, arg) {
2023 expression.accept1(visitor, arg);
2024 string.accept1(visitor, arg);
2025 }
2026
1629 Token getBeginToken() => expression.getBeginToken(); 2027 Token getBeginToken() => expression.getBeginToken();
1630 2028
1631 Token getEndToken() => string.getEndToken(); 2029 Token getEndToken() => string.getEndToken();
1632 } 2030 }
1633 2031
1634 /** 2032 /**
1635 * A class representing juxtaposed string literals. 2033 * A class representing juxtaposed string literals.
1636 * The string literals can be both plain literals and string interpolations. 2034 * The string literals can be both plain literals and string interpolations.
1637 */ 2035 */
1638 class StringJuxtaposition extends StringNode { 2036 class StringJuxtaposition extends StringNode {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 if (firstString == null || secondString == null) { 2078 if (firstString == null || secondString == null) {
1681 return null; 2079 return null;
1682 } 2080 }
1683 dartStringCache = new DartString.concat(firstString, secondString); 2081 dartStringCache = new DartString.concat(firstString, secondString);
1684 } 2082 }
1685 return dartStringCache; 2083 return dartStringCache;
1686 } 2084 }
1687 2085
1688 accept(Visitor visitor) => visitor.visitStringJuxtaposition(this); 2086 accept(Visitor visitor) => visitor.visitStringJuxtaposition(this);
1689 2087
2088 accept1(Visitor1 visitor, arg) => visitor.visitStringJuxtaposition(this, arg);
2089
1690 void visitChildren(Visitor visitor) { 2090 void visitChildren(Visitor visitor) {
1691 first.accept(visitor); 2091 first.accept(visitor);
1692 second.accept(visitor); 2092 second.accept(visitor);
1693 } 2093 }
1694 2094
2095 void visitChildren1(Visitor1 visitor, arg) {
2096 first.accept1(visitor, arg);
2097 second.accept1(visitor, arg);
2098 }
2099
1695 Token getBeginToken() => first.getBeginToken(); 2100 Token getBeginToken() => first.getBeginToken();
1696 2101
1697 Token getEndToken() => second.getEndToken(); 2102 Token getEndToken() => second.getEndToken();
1698 } 2103 }
1699 2104
1700 class EmptyStatement extends Statement { 2105 class EmptyStatement extends Statement {
1701 final Token semicolonToken; 2106 final Token semicolonToken;
1702 2107
1703 EmptyStatement(this.semicolonToken); 2108 EmptyStatement(this.semicolonToken);
1704 2109
1705 EmptyStatement asEmptyStatement() => this; 2110 EmptyStatement asEmptyStatement() => this;
1706 2111
1707 accept(Visitor visitor) => visitor.visitEmptyStatement(this); 2112 accept(Visitor visitor) => visitor.visitEmptyStatement(this);
1708 2113
2114 accept1(Visitor1 visitor, arg) => visitor.visitEmptyStatement(this, arg);
2115
1709 visitChildren(Visitor visitor) {} 2116 visitChildren(Visitor visitor) {}
1710 2117
2118 visitChildren1(Visitor1 visitor, arg) {}
2119
1711 Token getBeginToken() => semicolonToken; 2120 Token getBeginToken() => semicolonToken;
1712 2121
1713 Token getEndToken() => semicolonToken; 2122 Token getEndToken() => semicolonToken;
1714 } 2123 }
1715 2124
1716 class LiteralMap extends Expression { 2125 class LiteralMap extends Expression {
1717 final NodeList typeArguments; 2126 final NodeList typeArguments;
1718 final NodeList entries; 2127 final NodeList entries;
1719 2128
1720 final Token constKeyword; 2129 final Token constKeyword;
1721 2130
1722 LiteralMap(this.typeArguments, this.entries, this.constKeyword); 2131 LiteralMap(this.typeArguments, this.entries, this.constKeyword);
1723 2132
1724 bool get isConst => constKeyword != null; 2133 bool get isConst => constKeyword != null;
1725 2134
1726 LiteralMap asLiteralMap() => this; 2135 LiteralMap asLiteralMap() => this;
1727 2136
1728 accept(Visitor visitor) => visitor.visitLiteralMap(this); 2137 accept(Visitor visitor) => visitor.visitLiteralMap(this);
1729 2138
2139 accept1(Visitor1 visitor, arg) => visitor.visitLiteralMap(this, arg);
2140
1730 visitChildren(Visitor visitor) { 2141 visitChildren(Visitor visitor) {
1731 if (typeArguments != null) typeArguments.accept(visitor); 2142 if (typeArguments != null) typeArguments.accept(visitor);
1732 entries.accept(visitor); 2143 entries.accept(visitor);
1733 } 2144 }
1734 2145
2146 visitChildren1(Visitor1 visitor, arg) {
2147 if (typeArguments != null) typeArguments.accept1(visitor, arg);
2148 entries.accept1(visitor, arg);
2149 }
2150
1735 Token getBeginToken() { 2151 Token getBeginToken() {
1736 if (constKeyword != null) return constKeyword; 2152 if (constKeyword != null) return constKeyword;
1737 return firstBeginToken(typeArguments, entries); 2153 return firstBeginToken(typeArguments, entries);
1738 } 2154 }
1739 2155
1740 Token getEndToken() => entries.getEndToken(); 2156 Token getEndToken() => entries.getEndToken();
1741 } 2157 }
1742 2158
1743 class LiteralMapEntry extends Node { 2159 class LiteralMapEntry extends Node {
1744 final Expression key; 2160 final Expression key;
1745 final Expression value; 2161 final Expression value;
1746 2162
1747 final Token colonToken; 2163 final Token colonToken;
1748 2164
1749 LiteralMapEntry(this.key, this.colonToken, this.value); 2165 LiteralMapEntry(this.key, this.colonToken, this.value);
1750 2166
1751 LiteralMapEntry asLiteralMapEntry() => this; 2167 LiteralMapEntry asLiteralMapEntry() => this;
1752 2168
1753 accept(Visitor visitor) => visitor.visitLiteralMapEntry(this); 2169 accept(Visitor visitor) => visitor.visitLiteralMapEntry(this);
1754 2170
2171 accept1(Visitor1 visitor, arg) => visitor.visitLiteralMapEntry(this, arg);
2172
1755 visitChildren(Visitor visitor) { 2173 visitChildren(Visitor visitor) {
1756 key.accept(visitor); 2174 key.accept(visitor);
1757 value.accept(visitor); 2175 value.accept(visitor);
1758 } 2176 }
1759 2177
2178 visitChildren1(Visitor1 visitor, arg) {
2179 key.accept1(visitor, arg);
2180 value.accept1(visitor, arg);
2181 }
2182
1760 Token getBeginToken() => key.getBeginToken(); 2183 Token getBeginToken() => key.getBeginToken();
1761 2184
1762 Token getEndToken() => value.getEndToken(); 2185 Token getEndToken() => value.getEndToken();
1763 } 2186 }
1764 2187
1765 class NamedArgument extends Expression { 2188 class NamedArgument extends Expression {
1766 final Identifier name; 2189 final Identifier name;
1767 final Expression expression; 2190 final Expression expression;
1768 2191
1769 final Token colonToken; 2192 final Token colonToken;
1770 2193
1771 NamedArgument(this.name, this.colonToken, this.expression); 2194 NamedArgument(this.name, this.colonToken, this.expression);
1772 2195
1773 NamedArgument asNamedArgument() => this; 2196 NamedArgument asNamedArgument() => this;
1774 2197
1775 accept(Visitor visitor) => visitor.visitNamedArgument(this); 2198 accept(Visitor visitor) => visitor.visitNamedArgument(this);
1776 2199
2200 accept1(Visitor1 visitor, arg) => visitor.visitNamedArgument(this, arg);
2201
1777 visitChildren(Visitor visitor) { 2202 visitChildren(Visitor visitor) {
1778 name.accept(visitor); 2203 name.accept(visitor);
1779 expression.accept(visitor); 2204 expression.accept(visitor);
1780 } 2205 }
1781 2206
2207 visitChildren1(Visitor1 visitor, arg) {
2208 name.accept1(visitor, arg);
2209 expression.accept1(visitor, arg);
2210 }
2211
1782 Token getBeginToken() => name.getBeginToken(); 2212 Token getBeginToken() => name.getBeginToken();
1783 2213
1784 Token getEndToken() => expression.getEndToken(); 2214 Token getEndToken() => expression.getEndToken();
1785 } 2215 }
1786 2216
1787 class SwitchStatement extends Statement { 2217 class SwitchStatement extends Statement {
1788 final ParenthesizedExpression parenthesizedExpression; 2218 final ParenthesizedExpression parenthesizedExpression;
1789 final NodeList cases; 2219 final NodeList cases;
1790 2220
1791 final Token switchKeyword; 2221 final Token switchKeyword;
1792 2222
1793 SwitchStatement(this.parenthesizedExpression, this.cases, 2223 SwitchStatement(this.parenthesizedExpression, this.cases,
1794 this.switchKeyword); 2224 this.switchKeyword);
1795 2225
1796 SwitchStatement asSwitchStatement() => this; 2226 SwitchStatement asSwitchStatement() => this;
1797 2227
1798 Expression get expression => parenthesizedExpression.expression; 2228 Expression get expression => parenthesizedExpression.expression;
1799 2229
1800 accept(Visitor visitor) => visitor.visitSwitchStatement(this); 2230 accept(Visitor visitor) => visitor.visitSwitchStatement(this);
1801 2231
2232 accept1(Visitor1 visitor, arg) => visitor.visitSwitchStatement(this, arg);
2233
1802 visitChildren(Visitor visitor) { 2234 visitChildren(Visitor visitor) {
1803 parenthesizedExpression.accept(visitor); 2235 parenthesizedExpression.accept(visitor);
1804 cases.accept(visitor); 2236 cases.accept(visitor);
1805 } 2237 }
1806 2238
2239 visitChildren1(Visitor1 visitor, arg) {
2240 parenthesizedExpression.accept1(visitor, arg);
2241 cases.accept1(visitor, arg);
2242 }
2243
1807 Token getBeginToken() => switchKeyword; 2244 Token getBeginToken() => switchKeyword;
1808 2245
1809 Token getEndToken() => cases.getEndToken(); 2246 Token getEndToken() => cases.getEndToken();
1810 } 2247 }
1811 2248
1812 class CaseMatch extends Node { 2249 class CaseMatch extends Node {
1813 final Token caseKeyword; 2250 final Token caseKeyword;
1814 final Expression expression; 2251 final Expression expression;
1815 final Token colonToken; 2252 final Token colonToken;
1816 CaseMatch(this.caseKeyword, this.expression, this.colonToken); 2253 CaseMatch(this.caseKeyword, this.expression, this.colonToken);
1817 2254
1818 CaseMatch asCaseMatch() => this; 2255 CaseMatch asCaseMatch() => this;
1819 Token getBeginToken() => caseKeyword; 2256 Token getBeginToken() => caseKeyword;
1820 Token getEndToken() => colonToken; 2257 Token getEndToken() => colonToken;
2258
1821 accept(Visitor visitor) => visitor.visitCaseMatch(this); 2259 accept(Visitor visitor) => visitor.visitCaseMatch(this);
2260
2261 accept1(Visitor1 visitor, arg) => visitor.visitCaseMatch(this, arg);
2262
1822 visitChildren(Visitor visitor) => expression.accept(visitor); 2263 visitChildren(Visitor visitor) => expression.accept(visitor);
2264
2265 visitChildren1(Visitor1 visitor, arg) => expression.accept1(visitor, arg);
1823 } 2266 }
1824 2267
1825 class SwitchCase extends Node { 2268 class SwitchCase extends Node {
1826 // The labels and case patterns are collected in [labelsAndCases]. 2269 // The labels and case patterns are collected in [labelsAndCases].
1827 // The default keyword, if present, is collected in [defaultKeyword]. 2270 // The default keyword, if present, is collected in [defaultKeyword].
1828 // Any actual switch case must have at least one 'case' or 'default' 2271 // Any actual switch case must have at least one 'case' or 'default'
1829 // clause. 2272 // clause.
1830 // Notice: The labels and cases can occur interleaved in the source. 2273 // Notice: The labels and cases can occur interleaved in the source.
1831 // They are separated here, since the order is irrelevant to the meaning 2274 // They are separated here, since the order is irrelevant to the meaning
1832 // of the switch. 2275 // of the switch.
(...skipping 11 matching lines...) Expand all
1844 this.statements, this.startToken); 2287 this.statements, this.startToken);
1845 2288
1846 SwitchCase asSwitchCase() => this; 2289 SwitchCase asSwitchCase() => this;
1847 2290
1848 bool get isDefaultCase => defaultKeyword != null; 2291 bool get isDefaultCase => defaultKeyword != null;
1849 2292
1850 bool isValidContinueTarget() => true; 2293 bool isValidContinueTarget() => true;
1851 2294
1852 accept(Visitor visitor) => visitor.visitSwitchCase(this); 2295 accept(Visitor visitor) => visitor.visitSwitchCase(this);
1853 2296
2297 accept1(Visitor1 visitor, arg) => visitor.visitSwitchCase(this, arg);
2298
1854 visitChildren(Visitor visitor) { 2299 visitChildren(Visitor visitor) {
1855 labelsAndCases.accept(visitor); 2300 labelsAndCases.accept(visitor);
1856 statements.accept(visitor); 2301 statements.accept(visitor);
1857 } 2302 }
1858 2303
2304 visitChildren1(Visitor1 visitor, arg) {
2305 labelsAndCases.accept1(visitor, arg);
2306 statements.accept1(visitor, arg);
2307 }
2308
1859 Token getBeginToken() { 2309 Token getBeginToken() {
1860 return startToken; 2310 return startToken;
1861 } 2311 }
1862 2312
1863 Token getEndToken() { 2313 Token getEndToken() {
1864 if (statements.nodes.isEmpty) { 2314 if (statements.nodes.isEmpty) {
1865 // All cases must have at least one expression or be the default. 2315 // All cases must have at least one expression or be the default.
1866 if (defaultKeyword != null) { 2316 if (defaultKeyword != null) {
1867 // The colon after 'default'. 2317 // The colon after 'default'.
1868 return defaultKeyword.next; 2318 return defaultKeyword.next;
(...skipping 10 matching lines...) Expand all
1879 final Identifier target; 2329 final Identifier target;
1880 final Token keywordToken; 2330 final Token keywordToken;
1881 final Token semicolonToken; 2331 final Token semicolonToken;
1882 2332
1883 GotoStatement(this.target, this.keywordToken, this.semicolonToken); 2333 GotoStatement(this.target, this.keywordToken, this.semicolonToken);
1884 2334
1885 visitChildren(Visitor visitor) { 2335 visitChildren(Visitor visitor) {
1886 if (target != null) target.accept(visitor); 2336 if (target != null) target.accept(visitor);
1887 } 2337 }
1888 2338
2339 visitChildren1(Visitor1 visitor, arg) {
2340 if (target != null) target.accept1(visitor, arg);
2341 }
2342
1889 Token getBeginToken() => keywordToken; 2343 Token getBeginToken() => keywordToken;
1890 2344
1891 Token getEndToken() => semicolonToken; 2345 Token getEndToken() => semicolonToken;
1892 2346
1893 // TODO(ahe): make class abstract instead of adding an abstract method. 2347 // TODO(ahe): make class abstract instead of adding an abstract method.
1894 accept(Visitor visitor); 2348 accept(Visitor visitor);
1895 } 2349 }
1896 2350
1897 class BreakStatement extends GotoStatement { 2351 class BreakStatement extends GotoStatement {
1898 BreakStatement(Identifier target, Token keywordToken, Token semicolonToken) 2352 BreakStatement(Identifier target, Token keywordToken, Token semicolonToken)
1899 : super(target, keywordToken, semicolonToken); 2353 : super(target, keywordToken, semicolonToken);
1900 2354
1901 BreakStatement asBreakStatement() => this; 2355 BreakStatement asBreakStatement() => this;
1902 2356
1903 accept(Visitor visitor) => visitor.visitBreakStatement(this); 2357 accept(Visitor visitor) => visitor.visitBreakStatement(this);
2358
2359 accept1(Visitor1 visitor, arg) => visitor.visitBreakStatement(this, arg);
1904 } 2360 }
1905 2361
1906 class ContinueStatement extends GotoStatement { 2362 class ContinueStatement extends GotoStatement {
1907 ContinueStatement(Identifier target, Token keywordToken, Token semicolonToken) 2363 ContinueStatement(Identifier target, Token keywordToken, Token semicolonToken)
1908 : super(target, keywordToken, semicolonToken); 2364 : super(target, keywordToken, semicolonToken);
1909 2365
1910 ContinueStatement asContinueStatement() => this; 2366 ContinueStatement asContinueStatement() => this;
1911 2367
1912 accept(Visitor visitor) => visitor.visitContinueStatement(this); 2368 accept(Visitor visitor) => visitor.visitContinueStatement(this);
2369
2370 accept1(Visitor1 visitor, arg) => visitor.visitContinueStatement(this, arg);
1913 } 2371 }
1914 2372
1915 abstract class ForIn extends Loop { 2373 abstract class ForIn extends Loop {
1916 final Node declaredIdentifier; 2374 final Node declaredIdentifier;
1917 final Expression expression; 2375 final Expression expression;
1918 2376
1919 final Token forToken; 2377 final Token forToken;
1920 final Token inToken; 2378 final Token inToken;
1921 2379
1922 ForIn(this.declaredIdentifier, this.expression, 2380 ForIn(this.declaredIdentifier, this.expression,
1923 Statement body, this.forToken, this.inToken) 2381 Statement body, this.forToken, this.inToken)
1924 : super(body); 2382 : super(body);
1925 2383
1926 Expression get condition => null; 2384 Expression get condition => null;
1927 2385
1928 ForIn asForIn() => this; 2386 ForIn asForIn() => this;
1929 2387
1930 Token getEndToken() => body.getEndToken(); 2388 Token getEndToken() => body.getEndToken();
1931 } 2389 }
1932 2390
1933 class SyncForIn extends ForIn with StoredTreeElementMixin { 2391 class SyncForIn extends ForIn with StoredTreeElementMixin {
1934 SyncForIn(declaredIdentifier, expression, Statement body, forToken, inToken) 2392 SyncForIn(declaredIdentifier, expression, Statement body, forToken, inToken)
1935 : super(declaredIdentifier, expression, body, forToken, inToken); 2393 : super(declaredIdentifier, expression, body, forToken, inToken);
1936 2394
1937 SyncForIn asSyncForIn() => this; 2395 SyncForIn asSyncForIn() => this;
1938 2396
1939 accept(Visitor visitor) => visitor.visitSyncForIn(this); 2397 accept(Visitor visitor) => visitor.visitSyncForIn(this);
1940 2398
2399 accept1(Visitor1 visitor, arg) => visitor.visitSyncForIn(this, arg);
2400
1941 visitChildren(Visitor visitor) { 2401 visitChildren(Visitor visitor) {
1942 declaredIdentifier.accept(visitor); 2402 declaredIdentifier.accept(visitor);
1943 expression.accept(visitor); 2403 expression.accept(visitor);
1944 body.accept(visitor); 2404 body.accept(visitor);
1945 } 2405 }
1946 2406
2407 visitChildren1(Visitor1 visitor, arg) {
2408 declaredIdentifier.accept1(visitor, arg);
2409 expression.accept1(visitor, arg);
2410 body.accept1(visitor, arg);
2411 }
2412
1947 Token getBeginToken() => forToken; 2413 Token getBeginToken() => forToken;
1948 } 2414 }
1949 2415
1950 class AsyncForIn extends ForIn with StoredTreeElementMixin { 2416 class AsyncForIn extends ForIn with StoredTreeElementMixin {
1951 final Token awaitToken; 2417 final Token awaitToken;
1952 2418
1953 AsyncForIn(declaredIdentifier, expression, 2419 AsyncForIn(declaredIdentifier, expression,
1954 Statement body, this.awaitToken, forToken, inToken) 2420 Statement body, this.awaitToken, forToken, inToken)
1955 : super(declaredIdentifier, expression, body, forToken, inToken); 2421 : super(declaredIdentifier, expression, body, forToken, inToken);
1956 2422
1957 AsyncForIn asAsyncForIn() => this; 2423 AsyncForIn asAsyncForIn() => this;
1958 2424
1959 accept(Visitor visitor) => visitor.visitAsyncForIn(this); 2425 accept(Visitor visitor) => visitor.visitAsyncForIn(this);
1960 2426
2427 accept1(Visitor1 visitor, arg) => visitor.visitAsyncForIn(this, arg);
2428
1961 visitChildren(Visitor visitor) { 2429 visitChildren(Visitor visitor) {
1962 declaredIdentifier.accept(visitor); 2430 declaredIdentifier.accept(visitor);
1963 expression.accept(visitor); 2431 expression.accept(visitor);
1964 body.accept(visitor); 2432 body.accept(visitor);
1965 } 2433 }
1966 2434
2435 visitChildren1(Visitor1 visitor, arg) {
2436 declaredIdentifier.accept1(visitor, arg);
2437 expression.accept1(visitor, arg);
2438 body.accept1(visitor, arg);
2439 }
2440
1967 Token getBeginToken() => awaitToken; 2441 Token getBeginToken() => awaitToken;
1968 } 2442 }
1969 2443
1970 class Label extends Node { 2444 class Label extends Node {
1971 final Identifier identifier; 2445 final Identifier identifier;
1972 final Token colonToken; 2446 final Token colonToken;
1973 2447
1974 Label(this.identifier, this.colonToken); 2448 Label(this.identifier, this.colonToken);
1975 2449
1976 String get labelName => identifier.source; 2450 String get labelName => identifier.source;
1977 2451
1978 Label asLabel() => this; 2452 Label asLabel() => this;
1979 2453
1980 accept(Visitor visitor) => visitor.visitLabel(this); 2454 accept(Visitor visitor) => visitor.visitLabel(this);
1981 2455
2456 accept1(Visitor1 visitor, arg) => visitor.visitLabel(this, arg);
2457
1982 void visitChildren(Visitor visitor) { 2458 void visitChildren(Visitor visitor) {
1983 identifier.accept(visitor); 2459 identifier.accept(visitor);
1984 } 2460 }
1985 2461
2462 void visitChildren1(Visitor1 visitor, arg) {
2463 identifier.accept1(visitor, arg);
2464 }
2465
1986 Token getBeginToken() => identifier.token; 2466 Token getBeginToken() => identifier.token;
1987 Token getEndToken() => colonToken; 2467 Token getEndToken() => colonToken;
1988 } 2468 }
1989 2469
1990 class LabeledStatement extends Statement { 2470 class LabeledStatement extends Statement {
1991 final NodeList labels; 2471 final NodeList labels;
1992 final Statement statement; 2472 final Statement statement;
1993 2473
1994 LabeledStatement(this.labels, this.statement); 2474 LabeledStatement(this.labels, this.statement);
1995 2475
1996 LabeledStatement asLabeledStatement() => this; 2476 LabeledStatement asLabeledStatement() => this;
1997 2477
1998 accept(Visitor visitor) => visitor.visitLabeledStatement(this); 2478 accept(Visitor visitor) => visitor.visitLabeledStatement(this);
1999 2479
2480 accept1(Visitor1 visitor, arg) => visitor.visitLabeledStatement(this, arg);
2481
2000 visitChildren(Visitor visitor) { 2482 visitChildren(Visitor visitor) {
2001 labels.accept(visitor); 2483 labels.accept(visitor);
2002 statement.accept(visitor); 2484 statement.accept(visitor);
2003 } 2485 }
2004 2486
2487 visitChildren1(Visitor1 visitor, arg) {
2488 labels.accept1(visitor, arg);
2489 statement.accept1(visitor, arg);
2490 }
2491
2005 Token getBeginToken() => labels.getBeginToken(); 2492 Token getBeginToken() => labels.getBeginToken();
2006 2493
2007 Token getEndToken() => statement.getEndToken(); 2494 Token getEndToken() => statement.getEndToken();
2008 2495
2009 bool isValidContinueTarget() => statement.isValidContinueTarget(); 2496 bool isValidContinueTarget() => statement.isValidContinueTarget();
2010 } 2497 }
2011 2498
2012 abstract class LibraryTag extends Node { 2499 abstract class LibraryTag extends Node {
2013 final List<MetadataAnnotation> metadata; 2500 final List<MetadataAnnotation> metadata;
2014 2501
(...skipping 15 matching lines...) Expand all
2030 this.name, 2517 this.name,
2031 List<MetadataAnnotation> metadata) 2518 List<MetadataAnnotation> metadata)
2032 : super(metadata); 2519 : super(metadata);
2033 2520
2034 bool get isLibraryName => true; 2521 bool get isLibraryName => true;
2035 2522
2036 LibraryName asLibraryName() => this; 2523 LibraryName asLibraryName() => this;
2037 2524
2038 accept(Visitor visitor) => visitor.visitLibraryName(this); 2525 accept(Visitor visitor) => visitor.visitLibraryName(this);
2039 2526
2527 accept1(Visitor1 visitor, arg) => visitor.visitLibraryName(this, arg);
2528
2040 visitChildren(Visitor visitor) => name.accept(visitor); 2529 visitChildren(Visitor visitor) => name.accept(visitor);
2041 2530
2531 visitChildren1(Visitor1 visitor, arg) => name.accept1(visitor, arg);
2532
2042 Token getBeginToken() => libraryKeyword; 2533 Token getBeginToken() => libraryKeyword;
2043 2534
2044 Token getEndToken() => name.getEndToken().next; 2535 Token getEndToken() => name.getEndToken().next;
2045 } 2536 }
2046 2537
2047 /** 2538 /**
2048 * This tag describes a dependency between one library and the exported 2539 * This tag describes a dependency between one library and the exported
2049 * identifiers of another library. The other library is specified by the [uri]. 2540 * identifiers of another library. The other library is specified by the [uri].
2050 * Combinators filter away some identifiers from the other library. 2541 * Combinators filter away some identifiers from the other library.
2051 */ 2542 */
(...skipping 30 matching lines...) Expand all
2082 List<MetadataAnnotation> metadata, 2573 List<MetadataAnnotation> metadata,
2083 {this.isDeferred}) 2574 {this.isDeferred})
2084 : super(uri, conditionalUris, combinators, metadata); 2575 : super(uri, conditionalUris, combinators, metadata);
2085 2576
2086 bool get isImport => true; 2577 bool get isImport => true;
2087 2578
2088 Import asImport() => this; 2579 Import asImport() => this;
2089 2580
2090 accept(Visitor visitor) => visitor.visitImport(this); 2581 accept(Visitor visitor) => visitor.visitImport(this);
2091 2582
2583 accept1(Visitor1 visitor, arg) => visitor.visitImport(this, arg);
2584
2092 visitChildren(Visitor visitor) { 2585 visitChildren(Visitor visitor) {
2093 uri.accept(visitor); 2586 uri.accept(visitor);
2094 if (prefix != null) prefix.accept(visitor); 2587 if (prefix != null) prefix.accept(visitor);
2095 if (combinators != null) combinators.accept(visitor); 2588 if (combinators != null) combinators.accept(visitor);
2096 } 2589 }
2097 2590
2591 visitChildren1(Visitor1 visitor, arg) {
2592 uri.accept1(visitor, arg);
2593 if (prefix != null) prefix.accept1(visitor, arg);
2594 if (combinators != null) combinators.accept1(visitor, arg);
2595 }
2596
2098 Token getBeginToken() => importKeyword; 2597 Token getBeginToken() => importKeyword;
2099 2598
2100 Token getEndToken() { 2599 Token getEndToken() {
2101 if (combinators != null) return combinators.getEndToken().next; 2600 if (combinators != null) return combinators.getEndToken().next;
2102 if (prefix != null) return prefix.getEndToken().next; 2601 if (prefix != null) return prefix.getEndToken().next;
2103 if (conditionalUris != null) return conditionalUris.getEndToken().next; 2602 if (conditionalUris != null) return conditionalUris.getEndToken().next;
2104 return uri.getEndToken().next; 2603 return uri.getEndToken().next;
2105 } 2604 }
2106 } 2605 }
2107 2606
(...skipping 12 matching lines...) Expand all
2120 // Value may be null. 2619 // Value may be null.
2121 final LiteralString value; 2620 final LiteralString value;
2122 final StringNode uri; 2621 final StringNode uri;
2123 2622
2124 ConditionalUri(this.ifToken, this.key, this.value, this.uri); 2623 ConditionalUri(this.ifToken, this.key, this.value, this.uri);
2125 2624
2126 ConditionalUri asConditionalUri() => this; 2625 ConditionalUri asConditionalUri() => this;
2127 2626
2128 accept(Visitor visitor) => visitor.visitConditionalUri(this); 2627 accept(Visitor visitor) => visitor.visitConditionalUri(this);
2129 2628
2629 accept1(Visitor1 visitor, arg) => visitor.visitConditionalUri(this, arg);
2630
2130 visitChildren(Visitor visitor) { 2631 visitChildren(Visitor visitor) {
2131 key.accept(visitor); 2632 key.accept(visitor);
2132 if (value != null) value.accept(visitor); 2633 if (value != null) value.accept(visitor);
2133 uri.accept(visitor); 2634 uri.accept(visitor);
2134 } 2635 }
2135 2636
2637 visitChildren1(Visitor1 visitor, arg) {
2638 key.accept1(visitor, arg);
2639 if (value != null) value.accept1(visitor, arg);
2640 uri.accept1(visitor, arg);
2641 }
2642
2136 Token getBeginToken() => ifToken; 2643 Token getBeginToken() => ifToken;
2137 2644
2138 Token getEndToken() => uri.getEndToken(); 2645 Token getEndToken() => uri.getEndToken();
2139 } 2646 }
2140 2647
2141 /** 2648 /**
2142 * An `enum` declaration. 2649 * An `enum` declaration.
2143 * 2650 *
2144 * An `enum` defines a number of named constants inside a non-extensible class 2651 * An `enum` defines a number of named constants inside a non-extensible class
2145 */ 2652 */
2146 class Enum extends Node { 2653 class Enum extends Node {
2147 /** The name of the enum class. */ 2654 /** The name of the enum class. */
2148 final Identifier name; 2655 final Identifier name;
2149 /** The names of the enum constants. */ 2656 /** The names of the enum constants. */
2150 final NodeList names; 2657 final NodeList names;
2151 final Token enumToken; 2658 final Token enumToken;
2152 2659
2153 Enum(this.enumToken, this.name, this.names); 2660 Enum(this.enumToken, this.name, this.names);
2154 2661
2155 Enum asEnum() => this; 2662 Enum asEnum() => this;
2156 2663
2157 accept(Visitor visitor) => visitor.visitEnum(this); 2664 accept(Visitor visitor) => visitor.visitEnum(this);
2158 2665
2666 accept1(Visitor1 visitor, arg) => visitor.visitEnum(this, arg);
2667
2159 visitChildren(Visitor visitor) { 2668 visitChildren(Visitor visitor) {
2160 name.accept(visitor); 2669 name.accept(visitor);
2161 if (names != null) names.accept(visitor); 2670 if (names != null) names.accept(visitor);
2162 } 2671 }
2163 2672
2673 visitChildren1(Visitor1 visitor, arg) {
2674 name.accept1(visitor, arg);
2675 if (names != null) names.accept1(visitor, arg);
2676 }
2677
2164 Token getBeginToken() => enumToken; 2678 Token getBeginToken() => enumToken;
2165 Token getEndToken() => names.getEndToken(); 2679 Token getEndToken() => names.getEndToken();
2166 } 2680 }
2167 2681
2168 /** 2682 /**
2169 * An [:export:] library tag. 2683 * An [:export:] library tag.
2170 * 2684 *
2171 * An export tag is dependency on another library where the exported identifiers 2685 * An export tag is dependency on another library where the exported identifiers
2172 * are put into the export scope of the exporting library. The export scope is 2686 * are put into the export scope of the exporting library. The export scope is
2173 * not visible inside the library. 2687 * not visible inside the library.
2174 */ 2688 */
2175 class Export extends LibraryDependency { 2689 class Export extends LibraryDependency {
2176 final Token exportKeyword; 2690 final Token exportKeyword;
2177 2691
2178 Export(this.exportKeyword, 2692 Export(this.exportKeyword,
2179 StringNode uri, 2693 StringNode uri,
2180 NodeList conditionalUris, 2694 NodeList conditionalUris,
2181 NodeList combinators, 2695 NodeList combinators,
2182 List<MetadataAnnotation> metadata) 2696 List<MetadataAnnotation> metadata)
2183 : super(uri, conditionalUris, combinators, metadata); 2697 : super(uri, conditionalUris, combinators, metadata);
2184 2698
2185 bool get isExport => true; 2699 bool get isExport => true;
2186 2700
2187 Export asExport() => this; 2701 Export asExport() => this;
2188 2702
2189 accept(Visitor visitor) => visitor.visitExport(this); 2703 accept(Visitor visitor) => visitor.visitExport(this);
2190 2704
2705 accept1(Visitor1 visitor, arg) => visitor.visitExport(this, arg);
2706
2191 visitChildren(Visitor visitor) { 2707 visitChildren(Visitor visitor) {
2192 uri.accept(visitor); 2708 uri.accept(visitor);
2193 if (combinators != null) combinators.accept(visitor); 2709 if (combinators != null) combinators.accept(visitor);
2194 } 2710 }
2195 2711
2712 visitChildren1(Visitor1 visitor, arg) {
2713 uri.accept1(visitor, arg);
2714 if (combinators != null) combinators.accept1(visitor, arg);
2715 }
2716
2196 Token getBeginToken() => exportKeyword; 2717 Token getBeginToken() => exportKeyword;
2197 2718
2198 Token getEndToken() { 2719 Token getEndToken() {
2199 if (combinators != null) return combinators.getEndToken().next; 2720 if (combinators != null) return combinators.getEndToken().next;
2200 if (conditionalUris != null) return conditionalUris.getEndToken().next; 2721 if (conditionalUris != null) return conditionalUris.getEndToken().next;
2201 return uri.getEndToken().next; 2722 return uri.getEndToken().next;
2202 } 2723 }
2203 } 2724 }
2204 2725
2205 class Part extends LibraryTag { 2726 class Part extends LibraryTag {
2206 final StringNode uri; 2727 final StringNode uri;
2207 2728
2208 final Token partKeyword; 2729 final Token partKeyword;
2209 2730
2210 Part(this.partKeyword, this.uri, List<MetadataAnnotation> metadata) 2731 Part(this.partKeyword, this.uri, List<MetadataAnnotation> metadata)
2211 : super(metadata); 2732 : super(metadata);
2212 2733
2213 bool get isPart => true; 2734 bool get isPart => true;
2214 2735
2215 Part asPart() => this; 2736 Part asPart() => this;
2216 2737
2217 accept(Visitor visitor) => visitor.visitPart(this); 2738 accept(Visitor visitor) => visitor.visitPart(this);
2218 2739
2740 accept1(Visitor1 visitor, arg) => visitor.visitPart(this, arg);
2741
2219 visitChildren(Visitor visitor) => uri.accept(visitor); 2742 visitChildren(Visitor visitor) => uri.accept(visitor);
2220 2743
2744 visitChildren1(Visitor1 visitor, arg) => uri.accept1(visitor, arg);
2745
2221 Token getBeginToken() => partKeyword; 2746 Token getBeginToken() => partKeyword;
2222 2747
2223 Token getEndToken() => uri.getEndToken().next; 2748 Token getEndToken() => uri.getEndToken().next;
2224 } 2749 }
2225 2750
2226 class PartOf extends Node { 2751 class PartOf extends Node {
2227 final Expression name; 2752 final Expression name;
2228 2753
2229 final Token partKeyword; 2754 final Token partKeyword;
2230 2755
2231 final List<MetadataAnnotation> metadata; 2756 final List<MetadataAnnotation> metadata;
2232 2757
2233 PartOf(this.partKeyword, this.name, this.metadata); 2758 PartOf(this.partKeyword, this.name, this.metadata);
2234 2759
2235 Token get ofKeyword => partKeyword.next; 2760 Token get ofKeyword => partKeyword.next;
2236 2761
2237 bool get isPartOf => true; 2762 bool get isPartOf => true;
2238 2763
2239 PartOf asPartOf() => this; 2764 PartOf asPartOf() => this;
2240 2765
2241 accept(Visitor visitor) => visitor.visitPartOf(this); 2766 accept(Visitor visitor) => visitor.visitPartOf(this);
2242 2767
2768 accept1(Visitor1 visitor, arg) => visitor.visitPartOf(this, arg);
2769
2243 visitChildren(Visitor visitor) => name.accept(visitor); 2770 visitChildren(Visitor visitor) => name.accept(visitor);
2244 2771
2772 visitChildren1(Visitor1 visitor, arg) => name.accept1(visitor, arg);
2773
2245 Token getBeginToken() => partKeyword; 2774 Token getBeginToken() => partKeyword;
2246 2775
2247 Token getEndToken() => name.getEndToken().next; 2776 Token getEndToken() => name.getEndToken().next;
2248 } 2777 }
2249 2778
2250 class Combinator extends Node { 2779 class Combinator extends Node {
2251 final NodeList identifiers; 2780 final NodeList identifiers;
2252 2781
2253 final Token keywordToken; 2782 final Token keywordToken;
2254 2783
2255 Combinator(this.identifiers, this.keywordToken); 2784 Combinator(this.identifiers, this.keywordToken);
2256 2785
2257 bool get isShow => identical(keywordToken.stringValue, 'show'); 2786 bool get isShow => identical(keywordToken.stringValue, 'show');
2258 2787
2259 bool get isHide => identical(keywordToken.stringValue, 'hide'); 2788 bool get isHide => identical(keywordToken.stringValue, 'hide');
2260 2789
2261 Combinator asCombinator() => this; 2790 Combinator asCombinator() => this;
2262 2791
2263 accept(Visitor visitor) => visitor.visitCombinator(this); 2792 accept(Visitor visitor) => visitor.visitCombinator(this);
2264 2793
2794 accept1(Visitor1 visitor, arg) => visitor.visitCombinator(this, arg);
2795
2265 visitChildren(Visitor visitor) => identifiers.accept(visitor); 2796 visitChildren(Visitor visitor) => identifiers.accept(visitor);
2266 2797
2798 visitChildren1(Visitor1 visitor, arg) => identifiers.accept1(visitor, arg);
2799
2267 Token getBeginToken() => keywordToken; 2800 Token getBeginToken() => keywordToken;
2268 2801
2269 Token getEndToken() => identifiers.getEndToken(); 2802 Token getEndToken() => identifiers.getEndToken();
2270 } 2803 }
2271 2804
2272 class Typedef extends Node { 2805 class Typedef extends Node {
2273 final TypeAnnotation returnType; 2806 final TypeAnnotation returnType;
2274 final Identifier name; 2807 final Identifier name;
2275 final NodeList typeParameters; 2808 final NodeList typeParameters;
2276 final NodeList formals; 2809 final NodeList formals;
2277 2810
2278 final Token typedefKeyword; 2811 final Token typedefKeyword;
2279 final Token endToken; 2812 final Token endToken;
2280 2813
2281 Typedef(this.returnType, this.name, this.typeParameters, this.formals, 2814 Typedef(this.returnType, this.name, this.typeParameters, this.formals,
2282 this.typedefKeyword, this.endToken); 2815 this.typedefKeyword, this.endToken);
2283 2816
2284 Typedef asTypedef() => this; 2817 Typedef asTypedef() => this;
2285 2818
2286 accept(Visitor visitor) => visitor.visitTypedef(this); 2819 accept(Visitor visitor) => visitor.visitTypedef(this);
2287 2820
2821 accept1(Visitor1 visitor, arg) => visitor.visitTypedef(this, arg);
2822
2288 visitChildren(Visitor visitor) { 2823 visitChildren(Visitor visitor) {
2289 if (returnType != null) returnType.accept(visitor); 2824 if (returnType != null) returnType.accept(visitor);
2290 name.accept(visitor); 2825 name.accept(visitor);
2291 if (typeParameters != null) typeParameters.accept(visitor); 2826 if (typeParameters != null) typeParameters.accept(visitor);
2292 formals.accept(visitor); 2827 formals.accept(visitor);
2293 } 2828 }
2294 2829
2830 visitChildren1(Visitor1 visitor, arg) {
2831 if (returnType != null) returnType.accept1(visitor, arg);
2832 name.accept1(visitor, arg);
2833 if (typeParameters != null) typeParameters.accept1(visitor, arg);
2834 formals.accept1(visitor, arg);
2835 }
2836
2295 Token getBeginToken() => typedefKeyword; 2837 Token getBeginToken() => typedefKeyword;
2296 2838
2297 Token getEndToken() => endToken; 2839 Token getEndToken() => endToken;
2298 } 2840 }
2299 2841
2300 class TryStatement extends Statement { 2842 class TryStatement extends Statement {
2301 final Block tryBlock; 2843 final Block tryBlock;
2302 final NodeList catchBlocks; 2844 final NodeList catchBlocks;
2303 final Block finallyBlock; 2845 final Block finallyBlock;
2304 2846
2305 final Token tryKeyword; 2847 final Token tryKeyword;
2306 final Token finallyKeyword; 2848 final Token finallyKeyword;
2307 2849
2308 TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock, 2850 TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock,
2309 this.tryKeyword, this.finallyKeyword); 2851 this.tryKeyword, this.finallyKeyword);
2310 2852
2311 TryStatement asTryStatement() => this; 2853 TryStatement asTryStatement() => this;
2312 2854
2313 accept(Visitor visitor) => visitor.visitTryStatement(this); 2855 accept(Visitor visitor) => visitor.visitTryStatement(this);
2314 2856
2857 accept1(Visitor1 visitor, arg) => visitor.visitTryStatement(this, arg);
2858
2315 visitChildren(Visitor visitor) { 2859 visitChildren(Visitor visitor) {
2316 tryBlock.accept(visitor); 2860 tryBlock.accept(visitor);
2317 catchBlocks.accept(visitor); 2861 catchBlocks.accept(visitor);
2318 if (finallyBlock != null) finallyBlock.accept(visitor); 2862 if (finallyBlock != null) finallyBlock.accept(visitor);
2319 } 2863 }
2320 2864
2865 visitChildren1(Visitor1 visitor, arg) {
2866 tryBlock.accept1(visitor, arg);
2867 catchBlocks.accept1(visitor, arg);
2868 if (finallyBlock != null) finallyBlock.accept1(visitor, arg);
2869 }
2870
2321 Token getBeginToken() => tryKeyword; 2871 Token getBeginToken() => tryKeyword;
2322 2872
2323 Token getEndToken() { 2873 Token getEndToken() {
2324 if (finallyBlock != null) return finallyBlock.getEndToken(); 2874 if (finallyBlock != null) return finallyBlock.getEndToken();
2325 if (!catchBlocks.isEmpty) return catchBlocks.getEndToken(); 2875 if (!catchBlocks.isEmpty) return catchBlocks.getEndToken();
2326 return tryBlock.getEndToken(); 2876 return tryBlock.getEndToken();
2327 } 2877 }
2328 } 2878 }
2329 2879
2330 class Cascade extends Expression { 2880 class Cascade extends Expression {
2331 final Expression expression; 2881 final Expression expression;
2332 Cascade(this.expression); 2882 Cascade(this.expression);
2333 2883
2334 Cascade asCascade() => this; 2884 Cascade asCascade() => this;
2335 accept(Visitor visitor) => visitor.visitCascade(this); 2885 accept(Visitor visitor) => visitor.visitCascade(this);
2336 2886
2887 accept1(Visitor1 visitor, arg) => visitor.visitCascade(this, arg);
2888
2337 void visitChildren(Visitor visitor) { 2889 void visitChildren(Visitor visitor) {
2338 expression.accept(visitor); 2890 expression.accept(visitor);
2339 } 2891 }
2340 2892
2893 void visitChildren1(Visitor1 visitor, arg) {
2894 expression.accept1(visitor, arg);
2895 }
2896
2341 Token getBeginToken() => expression.getBeginToken(); 2897 Token getBeginToken() => expression.getBeginToken();
2342 2898
2343 Token getEndToken() => expression.getEndToken(); 2899 Token getEndToken() => expression.getEndToken();
2344 } 2900 }
2345 2901
2346 class CascadeReceiver extends Expression { 2902 class CascadeReceiver extends Expression {
2347 final Expression expression; 2903 final Expression expression;
2348 final Token cascadeOperator; 2904 final Token cascadeOperator;
2349 CascadeReceiver(this.expression, this.cascadeOperator); 2905 CascadeReceiver(this.expression, this.cascadeOperator);
2350 2906
2351 CascadeReceiver asCascadeReceiver() => this; 2907 CascadeReceiver asCascadeReceiver() => this;
2352 accept(Visitor visitor) => visitor.visitCascadeReceiver(this); 2908 accept(Visitor visitor) => visitor.visitCascadeReceiver(this);
2353 2909
2910 accept1(Visitor1 visitor, arg) => visitor.visitCascadeReceiver(this, arg);
2911
2354 void visitChildren(Visitor visitor) { 2912 void visitChildren(Visitor visitor) {
2355 expression.accept(visitor); 2913 expression.accept(visitor);
2356 } 2914 }
2357 2915
2916 void visitChildren1(Visitor1 visitor, arg) {
2917 expression.accept1(visitor, arg);
2918 }
2919
2358 Token getBeginToken() => expression.getBeginToken(); 2920 Token getBeginToken() => expression.getBeginToken();
2359 2921
2360 Token getEndToken() => expression.getEndToken(); 2922 Token getEndToken() => expression.getEndToken();
2361 } 2923 }
2362 2924
2363 class CatchBlock extends Node { 2925 class CatchBlock extends Node {
2364 final TypeAnnotation type; 2926 final TypeAnnotation type;
2365 final NodeList formals; 2927 final NodeList formals;
2366 final Block block; 2928 final Block block;
2367 2929
2368 final Token onKeyword; 2930 final Token onKeyword;
2369 final Token catchKeyword; 2931 final Token catchKeyword;
2370 2932
2371 CatchBlock(this.type, this.formals, this.block, 2933 CatchBlock(this.type, this.formals, this.block,
2372 this.onKeyword, this.catchKeyword); 2934 this.onKeyword, this.catchKeyword);
2373 2935
2374 CatchBlock asCatchBlock() => this; 2936 CatchBlock asCatchBlock() => this;
2375 2937
2376 accept(Visitor visitor) => visitor.visitCatchBlock(this); 2938 accept(Visitor visitor) => visitor.visitCatchBlock(this);
2377 2939
2940 accept1(Visitor1 visitor, arg) => visitor.visitCatchBlock(this, arg);
2941
2378 Node get exception { 2942 Node get exception {
2379 if (formals == null || formals.nodes.isEmpty) return null; 2943 if (formals == null || formals.nodes.isEmpty) return null;
2380 VariableDefinitions declarations = formals.nodes.head; 2944 VariableDefinitions declarations = formals.nodes.head;
2381 return declarations.definitions.nodes.head; 2945 return declarations.definitions.nodes.head;
2382 } 2946 }
2383 2947
2384 Node get trace { 2948 Node get trace {
2385 if (formals == null || formals.nodes.isEmpty) return null; 2949 if (formals == null || formals.nodes.isEmpty) return null;
2386 Link<Node> declarations = formals.nodes.tail; 2950 Link<Node> declarations = formals.nodes.tail;
2387 if (declarations.isEmpty) return null; 2951 if (declarations.isEmpty) return null;
2388 VariableDefinitions head = declarations.head; 2952 VariableDefinitions head = declarations.head;
2389 return head.definitions.nodes.head; 2953 return head.definitions.nodes.head;
2390 } 2954 }
2391 2955
2392 visitChildren(Visitor visitor) { 2956 visitChildren(Visitor visitor) {
2393 if (type != null) type.accept(visitor); 2957 if (type != null) type.accept(visitor);
2394 if (formals != null) formals.accept(visitor); 2958 if (formals != null) formals.accept(visitor);
2395 block.accept(visitor); 2959 block.accept(visitor);
2396 } 2960 }
2397 2961
2962 visitChildren1(Visitor1 visitor, arg) {
2963 if (type != null) type.accept1(visitor, arg);
2964 if (formals != null) formals.accept1(visitor, arg);
2965 block.accept1(visitor, arg);
2966 }
2967
2398 Token getBeginToken() => onKeyword != null ? onKeyword : catchKeyword; 2968 Token getBeginToken() => onKeyword != null ? onKeyword : catchKeyword;
2399 2969
2400 Token getEndToken() => block.getEndToken(); 2970 Token getEndToken() => block.getEndToken();
2401 } 2971 }
2402 2972
2403 class Metadata extends Node { 2973 class Metadata extends Node {
2404 final Token token; 2974 final Token token;
2405 final Expression expression; 2975 final Expression expression;
2406 2976
2407 Metadata(this.token, this.expression); 2977 Metadata(this.token, this.expression);
2408 2978
2409 Metadata asMetadata() => this; 2979 Metadata asMetadata() => this;
2410 2980
2411 accept(Visitor visitor) => visitor.visitMetadata(this); 2981 accept(Visitor visitor) => visitor.visitMetadata(this);
2412 2982
2983 accept1(Visitor1 visitor, arg) => visitor.visitMetadata(this, arg);
2984
2413 visitChildren(Visitor visitor) { 2985 visitChildren(Visitor visitor) {
2414 expression.accept(visitor); 2986 expression.accept(visitor);
2415 } 2987 }
2416 2988
2989 visitChildren1(Visitor1 visitor, arg) {
2990 expression.accept1(visitor, arg);
2991 }
2992
2417 Token getBeginToken() => token; 2993 Token getBeginToken() => token;
2418 2994
2419 Token getEndToken() => expression.getEndToken(); 2995 Token getEndToken() => expression.getEndToken();
2420 } 2996 }
2421 2997
2422 class Initializers { 2998 class Initializers {
2423 static bool isSuperConstructorCall(Send node) { 2999 static bool isSuperConstructorCall(Send node) {
2424 return (node.receiver == null && node.selector.isSuper()) || 3000 return (node.receiver == null && node.selector.isSuper()) ||
2425 (node.receiver != null && 3001 (node.receiver != null &&
2426 node.receiver.isSuper() && 3002 node.receiver.isSuper() &&
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 3051
2476 Token get beginToken => token; 3052 Token get beginToken => token;
2477 Token get endToken => token; 3053 Token get endToken => token;
2478 3054
2479 Token getBeginToken() => token; 3055 Token getBeginToken() => token;
2480 3056
2481 Token getEndToken() => token; 3057 Token getEndToken() => token;
2482 3058
2483 accept(Visitor visitor) {} 3059 accept(Visitor visitor) {}
2484 3060
3061 accept1(Visitor1 visitor, arg) {}
3062
2485 visitChildren(Visitor visitor) {} 3063 visitChildren(Visitor visitor) {}
2486 3064
3065 visitChildren1(Visitor1 visitor, arg) {}
3066
2487 bool get isErroneous => true; 3067 bool get isErroneous => true;
2488 3068
2489 // FunctionExpression. 3069 // FunctionExpression.
2490 get asyncModifier => null; 3070 get asyncModifier => null;
2491 get parameters => null; 3071 get parameters => null;
2492 get body => null; 3072 get body => null;
2493 get returnType => null; 3073 get returnType => null;
2494 get modifiers => Modifiers.EMPTY; 3074 get modifiers => Modifiers.EMPTY;
2495 get initializers => null; 3075 get initializers => null;
2496 get getOrSet => null; 3076 get getOrSet => null;
2497 get isRedirectingFactory => false; 3077 get isRedirectingFactory => false;
2498 bool get hasBody => false; 3078 bool get hasBody => false;
2499 bool get hasEmptyBody => false; 3079 bool get hasEmptyBody => false;
2500 3080
2501 // VariableDefinitions. 3081 // VariableDefinitions.
2502 get metadata => null; 3082 get metadata => null;
2503 get type => null; 3083 get type => null;
2504 3084
2505 // Typedef. 3085 // Typedef.
2506 get typeParameters => null; 3086 get typeParameters => null;
2507 get formals => null; 3087 get formals => null;
2508 get typedefKeyword => null; 3088 get typedefKeyword => null;
2509 } 3089 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698