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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 * | 1073 * |
1074 * The constructor does not add the required quotes. If [value] is not | 1074 * The constructor does not add the required quotes. If [value] is not |
1075 * surrounded by quotes and property escaped, the resulting object is invalid | 1075 * surrounded by quotes and property escaped, the resulting object is invalid |
1076 * as a JS value. | 1076 * as a JS value. |
1077 * | 1077 * |
1078 * TODO(sra): Introduce variants for known valid strings that don't allocate a | 1078 * TODO(sra): Introduce variants for known valid strings that don't allocate a |
1079 * new string just to add quotes. | 1079 * new string just to add quotes. |
1080 */ | 1080 */ |
1081 LiteralString(this.value); | 1081 LiteralString(this.value); |
1082 | 1082 |
| 1083 /// Gets the value inside the string without the beginning and end quotes. |
| 1084 String get valueWithoutQuotes => value.substring(1, value.length - 1); |
| 1085 |
1083 accept(NodeVisitor visitor) => visitor.visitLiteralString(this); | 1086 accept(NodeVisitor visitor) => visitor.visitLiteralString(this); |
1084 LiteralString _clone() => new LiteralString(value); | 1087 LiteralString _clone() => new LiteralString(value); |
1085 } | 1088 } |
1086 | 1089 |
1087 class LiteralNumber extends Literal { | 1090 class LiteralNumber extends Literal { |
1088 final String value; // Must be a valid JavaScript number literal. | 1091 final String value; // Must be a valid JavaScript number literal. |
1089 | 1092 |
1090 LiteralNumber(this.value); | 1093 LiteralNumber(this.value); |
1091 | 1094 |
1092 accept(NodeVisitor visitor) => visitor.visitLiteralNumber(this); | 1095 accept(NodeVisitor visitor) => visitor.visitLiteralNumber(this); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 final Expression expression; | 1440 final Expression expression; |
1438 | 1441 |
1439 CommentExpression(this.comment, this.expression); | 1442 CommentExpression(this.comment, this.expression); |
1440 | 1443 |
1441 int get precedenceLevel => PRIMARY; | 1444 int get precedenceLevel => PRIMARY; |
1442 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); | 1445 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); |
1443 CommentExpression _clone() => new CommentExpression(comment, expression); | 1446 CommentExpression _clone() => new CommentExpression(comment, expression); |
1444 | 1447 |
1445 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); | 1448 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); |
1446 } | 1449 } |
OLD | NEW |