OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of js; | 5 part of js; |
6 | 6 |
7 abstract class NodeVisitor<T> { | 7 abstract class NodeVisitor<T> { |
8 T visitProgram(Program node); | 8 T visitProgram(Program node); |
9 | 9 |
10 T visitBlock(Block node); | 10 T visitBlock(Block node); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 accept(NodeVisitor visitor) => visitor.visitLiteralStatement(this); | 447 accept(NodeVisitor visitor) => visitor.visitLiteralStatement(this); |
448 void visitChildren(NodeVisitor visitor) { } | 448 void visitChildren(NodeVisitor visitor) { } |
449 } | 449 } |
450 | 450 |
451 abstract class Expression extends Node { | 451 abstract class Expression extends Node { |
452 int get precedenceLevel; | 452 int get precedenceLevel; |
453 | 453 |
454 Call callWith(List<Expression> arguments) => new Call(this, arguments); | 454 Call callWith(List<Expression> arguments) => new Call(this, arguments); |
455 | 455 |
456 New newWith(List<Expression> arguments) => new New(this, arguments); | |
457 | |
458 PropertyAccess operator [](expression) { | 456 PropertyAccess operator [](expression) { |
459 if (expression is Expression) { | 457 if (expression is Expression) { |
460 return new PropertyAccess(this, expression); | 458 return new PropertyAccess(this, expression); |
461 } else if (expression is int) { | 459 } else if (expression is int) { |
462 return new PropertyAccess.indexed(this, expression); | 460 return new PropertyAccess.indexed(this, expression); |
463 } else if (expression is String) { | 461 } else if (expression is String) { |
464 return new PropertyAccess.field(this, expression); | 462 return new PropertyAccess.field(this, expression); |
465 } else { | 463 } else { |
466 throw new ArgumentError('Expected an int, String, or Expression'); | 464 throw new ArgumentError('Expected an int, String, or Expression'); |
467 } | 465 } |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 */ | 1004 */ |
1007 class Comment extends Statement { | 1005 class Comment extends Statement { |
1008 final String comment; | 1006 final String comment; |
1009 | 1007 |
1010 Comment(this.comment); | 1008 Comment(this.comment); |
1011 | 1009 |
1012 accept(NodeVisitor visitor) => visitor.visitComment(this); | 1010 accept(NodeVisitor visitor) => visitor.visitComment(this); |
1013 | 1011 |
1014 void visitChildren(NodeVisitor visitor) {} | 1012 void visitChildren(NodeVisitor visitor) {} |
1015 } | 1013 } |
OLD | NEW |