| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 // Ignore comments by default. | 189 // Ignore comments by default. |
| 190 T visitComment(Comment node) => null; | 190 T visitComment(Comment node) => null; |
| 191 | 191 |
| 192 T visitAwait(Await node) => visitExpression(node); | 192 T visitAwait(Await node) => visitExpression(node); |
| 193 T visitDartYield(DartYield node) => visitStatement(node); | 193 T visitDartYield(DartYield node) => visitStatement(node); |
| 194 } | 194 } |
| 195 | 195 |
| 196 /// This tag interface has no behaviour but must be implemented by any class | 196 /// This tag interface has no behaviour but must be implemented by any class |
| 197 /// that is to be stored on a [Node] as source information. | 197 /// that is to be stored on a [Node] as source information. |
| 198 abstract class JavaScriptNodeSourceInformation {} | 198 abstract class JavaScriptNodeSourceInformation { |
| 199 const JavaScriptNodeSourceInformation(); |
| 200 } |
| 199 | 201 |
| 200 abstract class Node { | 202 abstract class Node { |
| 201 JavaScriptNodeSourceInformation get sourceInformation => _sourceInformation; | 203 JavaScriptNodeSourceInformation get sourceInformation => _sourceInformation; |
| 202 | 204 |
| 203 JavaScriptNodeSourceInformation _sourceInformation; | 205 JavaScriptNodeSourceInformation _sourceInformation; |
| 204 | 206 |
| 205 accept(NodeVisitor visitor); | 207 accept(NodeVisitor visitor); |
| 206 void visitChildren(NodeVisitor visitor); | 208 void visitChildren(NodeVisitor visitor); |
| 207 | 209 |
| 208 // Shallow clone of node. Does not clone positions since the only use of this | 210 // Shallow clone of node. Does not clone positions since the only use of this |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 | 1070 |
| 1069 StringConcatenation _clone() => new StringConcatenation(this.parts); | 1071 StringConcatenation _clone() => new StringConcatenation(this.parts); |
| 1070 } | 1072 } |
| 1071 | 1073 |
| 1072 class LiteralNumber extends Literal { | 1074 class LiteralNumber extends Literal { |
| 1073 final String value; // Must be a valid JavaScript number literal. | 1075 final String value; // Must be a valid JavaScript number literal. |
| 1074 | 1076 |
| 1075 LiteralNumber(this.value); | 1077 LiteralNumber(this.value); |
| 1076 | 1078 |
| 1077 int get precedenceLevel => value.startsWith('-') ? UNARY : PRIMARY; | 1079 int get precedenceLevel => value.startsWith('-') ? UNARY : PRIMARY; |
| 1078 | 1080 |
| 1079 accept(NodeVisitor visitor) => visitor.visitLiteralNumber(this); | 1081 accept(NodeVisitor visitor) => visitor.visitLiteralNumber(this); |
| 1080 LiteralNumber _clone() => new LiteralNumber(value); | 1082 LiteralNumber _clone() => new LiteralNumber(value); |
| 1081 } | 1083 } |
| 1082 | 1084 |
| 1083 class ArrayInitializer extends Expression { | 1085 class ArrayInitializer extends Expression { |
| 1084 final List<Expression> elements; | 1086 final List<Expression> elements; |
| 1085 | 1087 |
| 1086 ArrayInitializer(this.elements); | 1088 ArrayInitializer(this.elements); |
| 1087 | 1089 |
| 1088 accept(NodeVisitor visitor) => visitor.visitArrayInitializer(this); | 1090 accept(NodeVisitor visitor) => visitor.visitArrayInitializer(this); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 class Comment extends Statement { | 1287 class Comment extends Statement { |
| 1286 final String comment; | 1288 final String comment; |
| 1287 | 1289 |
| 1288 Comment(this.comment); | 1290 Comment(this.comment); |
| 1289 | 1291 |
| 1290 accept(NodeVisitor visitor) => visitor.visitComment(this); | 1292 accept(NodeVisitor visitor) => visitor.visitComment(this); |
| 1291 Comment _clone() => new Comment(comment); | 1293 Comment _clone() => new Comment(comment); |
| 1292 | 1294 |
| 1293 void visitChildren(NodeVisitor visitor) {} | 1295 void visitChildren(NodeVisitor visitor) {} |
| 1294 } | 1296 } |
| OLD | NEW |