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

Unified Diff: runtime/lib/string.cc

Issue 11414249: Move various top-level Unicode definitions into classes and methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments 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 | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string.cc
diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc
index ed1528ed18d5a175e1088820d7c93b8f898675bd..236c95da510997e4a1f34fd325e279c981ba3431 100644
--- a/runtime/lib/string.cc
+++ b/runtime/lib/string.cc
@@ -8,6 +8,7 @@
#include "vm/native_entry.h"
#include "vm/object.h"
#include "vm/symbols.h"
+#include "vm/unicode.h"
namespace dart {
@@ -30,15 +31,15 @@ DEFINE_NATIVE_ENTRY(StringBase_createFromCodePoints, 1) {
Exceptions::ThrowByType(Exceptions::kArgument, args);
}
intptr_t value = Smi::Cast(index_object).Value();
- if (value < 0) {
+ if (Utf::IsOutOfRange(value)) {
GrowableArray<const Object*> args;
Exceptions::ThrowByType(Exceptions::kArgument, args);
} else {
- if (value > 0xFF) {
+ if (!Utf::IsLatin1(value)) {
is_one_byte_string = false;
- }
- if (value > 0xFFFF) {
- utf16_len += 1;
+ if (Utf::IsSupplementary(value)) {
+ utf16_len += 1;
+ }
}
}
utf32_array[i] = value;
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698