Chromium Code Reviews| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 EscapedSourceDartString(source, length) : super(source, length); | 92 EscapedSourceDartString(source, length) : super(source, length); |
| 93 Iterator<int> iterator() { | 93 Iterator<int> iterator() { |
| 94 if (toStringCache != null) return new StringCodeIterator(toStringCache); | 94 if (toStringCache != null) return new StringCodeIterator(toStringCache); |
| 95 return new StringEscapeIterator(source); | 95 return new StringEscapeIterator(source); |
| 96 } | 96 } |
| 97 String slowToString() { | 97 String slowToString() { |
| 98 if (toStringCache != null) return toStringCache; | 98 if (toStringCache != null) return toStringCache; |
| 99 StringBuffer buffer = new StringBuffer(); | 99 StringBuffer buffer = new StringBuffer(); |
| 100 StringEscapeIterator it = new StringEscapeIterator(source); | 100 StringEscapeIterator it = new StringEscapeIterator(source); |
| 101 while (it.hasNext) { | 101 while (it.hasNext) { |
| 102 buffer.addCharCode(it.next()); | 102 int code = it.next(); |
|
floitsch
2012/11/08 15:28:21
leave as is?
erikcorry
2012/11/15 13:28:25
Done.
| |
| 103 buffer.addCharCode(code); | |
| 103 } | 104 } |
| 104 toStringCache = buffer.toString(); | 105 toStringCache = buffer.toString(); |
| 105 return toStringCache; | 106 return toStringCache; |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 /** | 110 /** |
| 110 * The concatenation of two [DartString]s. | 111 * The concatenation of two [DartString]s. |
| 111 */ | 112 */ |
| 112 class ConsDartString extends DartString { | 113 class ConsDartString extends DartString { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 for (int i = 0; i < 3; i++) { | 203 for (int i = 0; i < 3; i++) { |
| 203 code = source.next(); | 204 code = source.next(); |
| 204 value = value * 16 + hexDigitValue(code); | 205 value = value * 16 + hexDigitValue(code); |
| 205 } | 206 } |
| 206 return value; | 207 return value; |
| 207 } | 208 } |
| 208 return code; | 209 return code; |
| 209 } | 210 } |
| 210 } | 211 } |
| 211 | 212 |
| OLD | NEW |