Chromium Code Reviews| Index: sdk/lib/utf/utf_core.dart |
| diff --git a/sdk/lib/utf/utf_core.dart b/sdk/lib/utf/utf_core.dart |
| index fb9e0e42bb76822291eaacb85899e1ff300cf0d5..a1cedcece985c193b05a446ef78147a3bfc7d212 100644 |
| --- a/sdk/lib/utf/utf_core.dart |
| +++ b/sdk/lib/utf/utf_core.dart |
| @@ -2,20 +2,15 @@ |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| +// TODO(jmesserly): would be nice to have this on String (dartbug.com/6501). |
| /** |
| * Provide a list of Unicode codepoints for a given string. |
| */ |
| List<int> stringToCodepoints(String str) { |
| - List<int> codepoints; |
| - // TODO _is16BitCodeUnit() is used to work around a bug with dart2js |
| - // (http://code.google.com/p/dart/issues/detail?id=1357). Consider |
| - // removing after this issue is resolved. |
| - if (_is16BitCodeUnit()) { |
| - codepoints = _utf16CodeUnitsToCodepoints(str.charCodes); |
| - } else { |
| - codepoints = str.charCodes; |
| - } |
| - return codepoints; |
| + // Note: str.charCodes gives us 16-bit code units on all Dart implementations. |
| + // So we need to convert. The same is not true of "new String.fromCharCodes", |
| + // which accepts code points on the VM but not dart2js (dartbug.com/1357). |
| + return _utf16CodeUnitsToCodepoints(str.charCodes); |
|
Lasse Reichstein Nielsen
2012/11/06 09:57:38
This seems wasteful since charCodes currently crea
Jennifer Messerly
2012/11/06 18:41:20
Yeah, that sounds good. Thanks!
|
| } |
| /** |