| 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 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 LiteralString _clone() => new LiteralString(value); | 1084 LiteralString _clone() => new LiteralString(value); |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 class LiteralNumber extends Literal { | 1087 class LiteralNumber extends Literal { |
| 1088 final String value; // Must be a valid JavaScript number literal. | 1088 final String value; // Must be a valid JavaScript number literal. |
| 1089 | 1089 |
| 1090 LiteralNumber(this.value); | 1090 LiteralNumber(this.value); |
| 1091 | 1091 |
| 1092 accept(NodeVisitor visitor) => visitor.visitLiteralNumber(this); | 1092 accept(NodeVisitor visitor) => visitor.visitLiteralNumber(this); |
| 1093 LiteralNumber _clone() => new LiteralNumber(value); | 1093 LiteralNumber _clone() => new LiteralNumber(value); |
| 1094 |
| 1095 /** |
| 1096 * Use a different precedence level depending on whether the value contains a |
| 1097 * dot to ensure we generate `(1).toString()` and `1.0.toString()`. |
| 1098 */ |
| 1099 int get precedenceLevel => value.contains('.') ? PRIMARY : UNARY; |
| 1094 } | 1100 } |
| 1095 | 1101 |
| 1096 class ArrayInitializer extends Expression { | 1102 class ArrayInitializer extends Expression { |
| 1097 final List<Expression> elements; | 1103 final List<Expression> elements; |
| 1098 | 1104 |
| 1099 ArrayInitializer(this.elements); | 1105 ArrayInitializer(this.elements); |
| 1100 | 1106 |
| 1101 accept(NodeVisitor visitor) => visitor.visitArrayInitializer(this); | 1107 accept(NodeVisitor visitor) => visitor.visitArrayInitializer(this); |
| 1102 | 1108 |
| 1103 void visitChildren(NodeVisitor visitor) { | 1109 void visitChildren(NodeVisitor visitor) { |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 final Expression expression; | 1437 final Expression expression; |
| 1432 | 1438 |
| 1433 CommentExpression(this.comment, this.expression); | 1439 CommentExpression(this.comment, this.expression); |
| 1434 | 1440 |
| 1435 int get precedenceLevel => PRIMARY; | 1441 int get precedenceLevel => PRIMARY; |
| 1436 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); | 1442 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); |
| 1437 CommentExpression _clone() => new CommentExpression(comment, expression); | 1443 CommentExpression _clone() => new CommentExpression(comment, expression); |
| 1438 | 1444 |
| 1439 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); | 1445 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); |
| 1440 } | 1446 } |
| OLD | NEW |