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

Unified Diff: runtime/lib/mirrors.cc

Issue 23480005: Change Bool::Get to return a handle instead of a pointer to a raw object. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/mirrors.cc
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index bafb2ea95300c64a00bdd97ba885710a302e289a..507d180b78043b0cac54648739d6f95b9f2fd00b 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -41,7 +41,7 @@ DEFINE_NATIVE_ENTRY(Mirrors_isLocalPort, 1) {
Integer& id = Integer::Handle();
id ^= id_obj.raw();
Dart_Port port_id = static_cast<Dart_Port>(id.AsInt64Value());
- return Bool::Get(PortMap::IsLocalPort(port_id));
+ return Bool::Get(PortMap::IsLocalPort(port_id)).raw();
}
@@ -67,10 +67,8 @@ static RawInstance* CreateParameterMirrorList(const Function& func,
name ^= func.ParameterNameAt(implicit_param_count + i);
args.SetAt(1, name);
args.SetAt(3, pos);
- args.SetAt(4, (i >= index_of_first_optional_param) ?
- Bool::True() : Bool::False());
- args.SetAt(5, (i >= index_of_first_named_param) ?
- Bool::True() : Bool::False());
+ args.SetAt(4, Bool::Get(i >= index_of_first_optional_param));
+ args.SetAt(5, Bool::Get(i >= index_of_first_named_param));
param ^= CreateMirror(Symbols::_LocalParameterMirrorImpl(), args);
results.SetAt(i, param);
}
@@ -135,11 +133,11 @@ static RawInstance* CreateMethodMirror(const Function& func,
args.SetAt(0, MirrorReference::Handle(MirrorReference::New(func)));
args.SetAt(1, String::Handle(func.UserVisibleName()));
args.SetAt(2, owner_mirror);
- args.SetAt(3, func.is_static() ? Bool::True() : Bool::False());
- args.SetAt(4, func.is_abstract() ? Bool::True() : Bool::False());
- args.SetAt(5, func.IsGetterFunction() ? Bool::True() : Bool::False());
- args.SetAt(6, func.IsSetterFunction() ? Bool::True() : Bool::False());
- args.SetAt(7, func.IsConstructor() ? Bool::True() : Bool::False());
+ args.SetAt(3, Bool::Get(func.is_static()));
+ args.SetAt(4, Bool::Get(func.is_abstract()));
+ args.SetAt(5, Bool::Get(func.IsGetterFunction()));
+ args.SetAt(6, Bool::Get(func.IsSetterFunction()));
+ args.SetAt(7, Bool::Get(func.IsConstructor()));
// TODO(mlippautz): Implement different constructor kinds.
args.SetAt(8, Bool::False());
args.SetAt(9, Bool::False());
@@ -161,8 +159,8 @@ static RawInstance* CreateVariableMirror(const Field& field,
args.SetAt(1, name);
args.SetAt(2, owner_mirror);
args.SetAt(3, Instance::Handle()); // Null for type.
- args.SetAt(4, field.is_static() ? Bool::True() : Bool::False());
- args.SetAt(5, field.is_final() ? Bool::True() : Bool::False());
+ args.SetAt(4, Bool::Get(field.is_static()));
+ args.SetAt(5, Bool::Get(field.is_final()));
return CreateMirror(Symbols::_LocalVariableMirrorImpl(), args);
}
@@ -199,8 +197,7 @@ static RawInstance* CreateClassMirror(const Class& cls,
}
}
- const Bool& is_generic =
- (cls.NumTypeParameters() == 0) ? Bool::False() : Bool::True();
+ const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0);
const Array& args = Array::Handle(Array::New(4));
args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
@@ -357,7 +354,7 @@ static void ThrowInvokeError(const Error& error) {
DEFINE_NATIVE_ENTRY(MirrorReference_equals, 2) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, a, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, b, arguments->NativeArgAt(1));
- return Bool::Get(a.referent() == b.referent());
+ return Bool::Get(a.referent() == b.referent()).raw();
}
« no previous file with comments | « runtime/lib/integers.cc ('k') | runtime/lib/object.cc » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698