| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 T visitProperty(Property node) => visitNode(node); | 142 T visitProperty(Property node) => visitNode(node); |
| 143 T visitRegExpLiteral(RegExpLiteral node) => visitExpression(node); | 143 T visitRegExpLiteral(RegExpLiteral node) => visitExpression(node); |
| 144 } | 144 } |
| 145 | 145 |
| 146 abstract class Node { | 146 abstract class Node { |
| 147 var sourcePosition; | 147 var sourcePosition; |
| 148 var endSourcePosition; | 148 var endSourcePosition; |
| 149 | 149 |
| 150 accept(NodeVisitor visitor); | 150 accept(NodeVisitor visitor); |
| 151 void visitChildren(NodeVisitor visitor); | 151 void visitChildren(NodeVisitor visitor); |
| 152 |
| 153 VariableUse asVariableUse() => null; |
| 152 } | 154 } |
| 153 | 155 |
| 154 class Program extends Node { | 156 class Program extends Node { |
| 155 final List<Statement> body; | 157 final List<Statement> body; |
| 156 Program(this.body); | 158 Program(this.body); |
| 157 | 159 |
| 158 accept(NodeVisitor visitor) => visitor.visitProgram(this); | 160 accept(NodeVisitor visitor) => visitor.visitProgram(this); |
| 159 void visitChildren(NodeVisitor visitor) { | 161 void visitChildren(NodeVisitor visitor) { |
| 160 for (Statement statement in body) statement.accept(visitor); | 162 for (Statement statement in body) statement.accept(visitor); |
| 161 } | 163 } |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 652 |
| 651 accept(NodeVisitor visitor); | 653 accept(NodeVisitor visitor); |
| 652 int get precedenceLevel => PRIMARY; | 654 int get precedenceLevel => PRIMARY; |
| 653 void visitChildren(NodeVisitor visitor) {} | 655 void visitChildren(NodeVisitor visitor) {} |
| 654 } | 656 } |
| 655 | 657 |
| 656 class VariableUse extends VariableReference { | 658 class VariableUse extends VariableReference { |
| 657 VariableUse(String name) : super(name); | 659 VariableUse(String name) : super(name); |
| 658 | 660 |
| 659 accept(NodeVisitor visitor) => visitor.visitVariableUse(this); | 661 accept(NodeVisitor visitor) => visitor.visitVariableUse(this); |
| 662 |
| 663 VariableUse asVariableUse() => this; |
| 660 } | 664 } |
| 661 | 665 |
| 662 class VariableDeclaration extends VariableReference { | 666 class VariableDeclaration extends VariableReference { |
| 663 VariableDeclaration(String name) : super(name); | 667 VariableDeclaration(String name) : super(name); |
| 664 | 668 |
| 665 accept(NodeVisitor visitor) => visitor.visitVariableDeclaration(this); | 669 accept(NodeVisitor visitor) => visitor.visitVariableDeclaration(this); |
| 666 } | 670 } |
| 667 | 671 |
| 668 class Parameter extends VariableDeclaration { | 672 class Parameter extends VariableDeclaration { |
| 669 Parameter(String id) : super(id); | 673 Parameter(String id) : super(id); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 /** Contains the pattern and the flags.*/ | 850 /** Contains the pattern and the flags.*/ |
| 847 String pattern; | 851 String pattern; |
| 848 | 852 |
| 849 RegExpLiteral(this.pattern); | 853 RegExpLiteral(this.pattern); |
| 850 | 854 |
| 851 accept(NodeVisitor visitor) => visitor.visitRegExpLiteral(this); | 855 accept(NodeVisitor visitor) => visitor.visitRegExpLiteral(this); |
| 852 void visitChildren(NodeVisitor visitor) {} | 856 void visitChildren(NodeVisitor visitor) {} |
| 853 | 857 |
| 854 int get precedenceLevel => PRIMARY; | 858 int get precedenceLevel => PRIMARY; |
| 855 } | 859 } |
| OLD | NEW |