| 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 tree; | 5 part of tree; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The [DartString] type represents a Dart string value as a sequence of Unicode | 8 * The [DartString] type represents a Dart string value as a sequence of Unicode |
| 9 * Scalar Values. | 9 * Scalar Values. |
| 10 * After parsing, any valid [LiteralString] will contain a [DartString] | 10 * After parsing, any valid [LiteralString] will contain a [DartString] |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 String toStringCache; | 117 String toStringCache; |
| 118 ConsDartString(DartString left, DartString right) | 118 ConsDartString(DartString left, DartString right) |
| 119 : this.left = left, | 119 : this.left = left, |
| 120 this.right = right, | 120 this.right = right, |
| 121 length = left.length + right.length; | 121 length = left.length + right.length; |
| 122 | 122 |
| 123 Iterator<int> get iterator => new ConsDartStringIterator(this); | 123 Iterator<int> get iterator => new ConsDartStringIterator(this); |
| 124 | 124 |
| 125 String slowToString() { | 125 String slowToString() { |
| 126 if (toStringCache != null) return toStringCache; | 126 if (toStringCache != null) return toStringCache; |
| 127 toStringCache = left.slowToString().concat(right.slowToString()); | 127 toStringCache = left.slowToString() + right.slowToString(); |
| 128 return toStringCache; | 128 return toStringCache; |
| 129 } | 129 } |
| 130 SourceString get source => new StringWrapper(slowToString()); | 130 SourceString get source => new StringWrapper(slowToString()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 class ConsDartStringIterator implements Iterator<int> { | 133 class ConsDartStringIterator implements Iterator<int> { |
| 134 HasNextIterator<int> currentIterator; | 134 HasNextIterator<int> currentIterator; |
| 135 DartString right; | 135 DartString right; |
| 136 bool hasNextLookAhead; | 136 bool hasNextLookAhead; |
| 137 int _current = null; | 137 int _current = null; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 _current = value; | 227 _current = value; |
| 228 break; | 228 break; |
| 229 default: | 229 default: |
| 230 _current = code; | 230 _current = code; |
| 231 } | 231 } |
| 232 return true; | 232 return true; |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| OLD | NEW |