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_ast; | 5 part of js_ast; |
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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 int get precedenceLevel => EXPRESSION; | 604 int get precedenceLevel => EXPRESSION; |
605 } | 605 } |
606 | 606 |
607 class Assignment extends Expression { | 607 class Assignment extends Expression { |
608 final Expression leftHandSide; | 608 final Expression leftHandSide; |
609 final String op; // Null, if the assignment is not compound. | 609 final String op; // Null, if the assignment is not compound. |
610 final Expression value; // May be null, for [VariableInitialization]s. | 610 final Expression value; // May be null, for [VariableInitialization]s. |
611 | 611 |
612 Assignment(leftHandSide, value) | 612 Assignment(leftHandSide, value) |
613 : this.compound(leftHandSide, null, value); | 613 : this.compound(leftHandSide, null, value); |
| 614 // If `this.op == null` this will be a non-compound assignment. |
614 Assignment.compound(this.leftHandSide, this.op, this.value); | 615 Assignment.compound(this.leftHandSide, this.op, this.value); |
615 | 616 |
616 int get precedenceLevel => ASSIGNMENT; | 617 int get precedenceLevel => ASSIGNMENT; |
617 | 618 |
618 bool get isCompound => op != null; | 619 bool get isCompound => op != null; |
619 | 620 |
620 accept(NodeVisitor visitor) => visitor.visitAssignment(this); | 621 accept(NodeVisitor visitor) => visitor.visitAssignment(this); |
621 | 622 |
622 void visitChildren(NodeVisitor visitor) { | 623 void visitChildren(NodeVisitor visitor) { |
623 leftHandSide.accept(visitor); | 624 leftHandSide.accept(visitor); |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 class Comment extends Statement { | 1173 class Comment extends Statement { |
1173 final String comment; | 1174 final String comment; |
1174 | 1175 |
1175 Comment(this.comment); | 1176 Comment(this.comment); |
1176 | 1177 |
1177 accept(NodeVisitor visitor) => visitor.visitComment(this); | 1178 accept(NodeVisitor visitor) => visitor.visitComment(this); |
1178 Comment _clone() => new Comment(comment); | 1179 Comment _clone() => new Comment(comment); |
1179 | 1180 |
1180 void visitChildren(NodeVisitor visitor) {} | 1181 void visitChildren(NodeVisitor visitor) {} |
1181 } | 1182 } |
OLD | NEW |