Flutter Engine
The Flutter Engine
third_party
dart-lang
sdk
runtime
lib
bool.cc
Go to the documentation of this 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
3
// BSD-style license that can be found in the LICENSE file.
4
5
#include "
vm/bootstrap_natives.h
"
6
7
#include "
include/dart_api.h
"
8
#include "
vm/dart_api_impl.h
"
9
#include "
vm/dart_entry.h
"
10
#include "
vm/exceptions.h
"
11
#include "
vm/isolate.h
"
12
#include "
vm/native_entry.h
"
13
#include "
vm/object.h
"
14
#include "
vm/object_store.h
"
15
#include "
vm/symbols.h
"
16
17
namespace
dart
{
18
19
DEFINE_NATIVE_ENTRY
(Bool_fromEnvironment, 0, 3) {
20
GET_NON_NULL_NATIVE_ARGUMENT
(
String
,
name
, arguments->NativeArgAt(1));
21
GET_NATIVE_ARGUMENT
(
Bool
, default_value, arguments->NativeArgAt(2));
22
// Call the embedder to supply us with the environment.
23
const
String
& env_value =
24
String::Handle
(
Api::GetEnvironmentValue
(thread,
name
));
25
if
(!env_value.
IsNull
()) {
26
if
(
Symbols::True
().
Equals
(env_value)) {
27
return
Bool::True
().
ptr
();
28
}
29
if
(
Symbols::False
().
Equals
(env_value)) {
30
return
Bool::False
().
ptr
();
31
}
32
}
33
return
default_value.ptr();
34
}
35
36
DEFINE_NATIVE_ENTRY
(Bool_hasEnvironment, 0, 2) {
37
GET_NON_NULL_NATIVE_ARGUMENT
(
String
,
name
, arguments->NativeArgAt(1));
38
// Call the embedder to supply us with the environment.
39
const
String
& env_value =
40
String::Handle
(
Api::GetEnvironmentValue
(thread,
name
));
41
if
(!env_value.
IsNull
()) {
42
return
Bool::True
().
ptr
();
43
}
44
return
Bool::False
().
ptr
();
45
}
46
47
}
// namespace dart
bootstrap_natives.h
dart::Api::GetEnvironmentValue
static StringPtr GetEnvironmentValue(Thread *thread, const String &name)
Definition:
dart_api_impl.cc:5254
dart::Bool
Definition:
object.h:10789
dart::Bool::False
static const Bool & False()
Definition:
object.h:10799
dart::Bool::True
static const Bool & True()
Definition:
object.h:10797
dart::Object::ptr
ObjectPtr ptr() const
Definition:
object.h:332
dart::Object::IsNull
bool IsNull() const
Definition:
object.h:363
dart::Object::Handle
static Object & Handle()
Definition:
object.h:407
dart::String
Definition:
object.h:10158
dart::Symbols::True
static const String & True()
Definition:
symbols.h:693
dart::Symbols::False
static const String & False()
Definition:
symbols.h:689
dart_api.h
dart_api_impl.h
dart_entry.h
exceptions.h
isolate.h
dart
Definition:
dart_vm.cc:33
dart::Equals
static bool Equals(const Object &expected, const Object &actual)
Definition:
snapshot_test.cc:26
dart::name
const char *const name
Definition:
method_recognizer.cc:309
dart::DEFINE_NATIVE_ENTRY
DEFINE_NATIVE_ENTRY(List_allocate, 0, 2)
Definition:
array.cc:13
native_entry.h
GET_NATIVE_ARGUMENT
#define GET_NATIVE_ARGUMENT(type, name, value)
Definition:
native_entry.h:84
GET_NON_NULL_NATIVE_ARGUMENT
#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value)
Definition:
native_entry.h:74
object.h
object_store.h
symbols.h
Generated on Sun Jun 23 2024 21:55:24 for Flutter Engine by
1.9.4