| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 EscapedSourceDartString(source, length) : super(source, length); | 93 EscapedSourceDartString(source, length) : super(source, length); |
| 94 Iterator<int> get iterator { | 94 Iterator<int> get iterator { |
| 95 if (toStringCache != null) return new StringCodeIterator(toStringCache); | 95 if (toStringCache != null) return new StringCodeIterator(toStringCache); |
| 96 return new StringEscapeIterator(source); | 96 return new StringEscapeIterator(source); |
| 97 } | 97 } |
| 98 String slowToString() { | 98 String slowToString() { |
| 99 if (toStringCache != null) return toStringCache; | 99 if (toStringCache != null) return toStringCache; |
| 100 StringBuffer buffer = new StringBuffer(); | 100 StringBuffer buffer = new StringBuffer(); |
| 101 StringEscapeIterator it = new StringEscapeIterator(source); | 101 StringEscapeIterator it = new StringEscapeIterator(source); |
| 102 while (it.moveNext()) { | 102 while (it.moveNext()) { |
| 103 buffer.addCharCode(it.current); | 103 buffer.writeCharCode(it.current); |
| 104 } | 104 } |
| 105 toStringCache = buffer.toString(); | 105 toStringCache = buffer.toString(); |
| 106 return toStringCache; | 106 return toStringCache; |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * The concatenation of two [DartString]s. | 111 * The concatenation of two [DartString]s. |
| 112 */ | 112 */ |
| 113 class ConsDartString extends DartString { | 113 class ConsDartString extends DartString { |
| (...skipping 112 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 |