Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2532)

Unified Diff: sdk/lib/utf/utf_core.dart

Issue 11293080: fix stringToCodePoints on VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix expect order Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/utils/utf_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
/**
« no previous file with comments | « no previous file | tests/utils/utf_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698