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

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