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

Unified Diff: runtime/lib/string.cc

Issue 54663002: Change int.fromEnvironment in VM to use same code as int.parse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change order for String/bool too. Add canonicalization. Created 7 years, 2 months 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
Index: runtime/lib/string.cc
diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc
index ba42a57339a1643ec14246dc00d04558ce2193f1..ea67ae2b8035f0e5ce0e509efcfc83b88988b474 100644
--- a/runtime/lib/string.cc
+++ b/runtime/lib/string.cc
@@ -22,16 +22,16 @@ DEFINE_NATIVE_ENTRY(String_fromEnvironment, 3) {
Dart_EnvironmentCallback callback = isolate->environment_callback();
if (callback != NULL) {
Dart_Handle result = callback(Api::NewHandle(isolate, name.raw()));
- if (Dart_IsError(result)) {
+ if (Dart_IsString(result)) {
+ const Object& value =
+ Object::Handle(isolate, Api::UnwrapHandle(result));
+ return Symbols::New(String::Cast(value));
+ } else if (Dart_IsError(result)) {
const Object& error =
Object::Handle(isolate, Api::UnwrapHandle(result));
Exceptions::ThrowArgumentError(
String::Handle(
String::New(Error::Cast(error).ToErrorCString())));
- } else if (Dart_IsString(result)) {
- const Object& value =
- Object::Handle(isolate, Api::UnwrapHandle(result));
- return Symbols::New(String::Cast(value));
} else if (!Dart_IsNull(result)) {
Exceptions::ThrowArgumentError(
String::Handle(String::New("Illegal environment value")));

Powered by Google App Engine
This is Rietveld 408576698