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

Side by Side Diff: runtime/lib/bool.cc

Issue 1640853004: Support 'dart.library.X' env variables in the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase and fix typo. Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/lib/integers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
11 #include "vm/isolate.h" 11 #include "vm/isolate.h"
12 #include "vm/native_entry.h" 12 #include "vm/native_entry.h"
13 #include "vm/object.h" 13 #include "vm/object.h"
14 #include "vm/object_store.h" 14 #include "vm/object_store.h"
15 #include "vm/symbols.h" 15 #include "vm/symbols.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 DEFINE_NATIVE_ENTRY(Bool_fromEnvironment, 3) { 19 DEFINE_NATIVE_ENTRY(Bool_fromEnvironment, 3) {
20 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1)); 20 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1));
21 GET_NATIVE_ARGUMENT(Bool, default_value, arguments->NativeArgAt(2)); 21 GET_NATIVE_ARGUMENT(Bool, default_value, arguments->NativeArgAt(2));
22 // Call the embedder to supply us with the environment. 22 // Call the embedder to supply us with the environment.
23 const String& env_value = 23 const String& env_value =
24 String::Handle(Api::CallEnvironmentCallback(thread, name)); 24 String::Handle(Api::GetEnvironmentValue(thread, name));
25 if (!env_value.IsNull()) { 25 if (!env_value.IsNull()) {
26 if (Symbols::True().Equals(env_value)) { 26 if (Symbols::True().Equals(env_value)) {
27 return Bool::True().raw(); 27 return Bool::True().raw();
28 } 28 }
29 if (Symbols::False().Equals(env_value)) { 29 if (Symbols::False().Equals(env_value)) {
30 return Bool::False().raw(); 30 return Bool::False().raw();
31 } 31 }
32 } 32 }
33 return default_value.raw(); 33 return default_value.raw();
34 } 34 }
35 35
36 } // namespace dart 36 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/integers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698