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

Unified Diff: runtime/vm/debugger_api_impl.cc

Issue 24210003: Never return a Dart_Handle on a dart::Class from the embedding API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove Dart_IsClass from header. remove demo assert Created 7 years, 3 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
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_api_impl.cc
diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc
index 65eedb662e82f845398c9f7b57d6849eef1865a1..130decd11a10716264186322019a56d4ee8e7b04 100644
--- a/runtime/vm/debugger_api_impl.cc
+++ b/runtime/vm/debugger_api_impl.cc
@@ -459,19 +459,12 @@ DART_EXPORT Dart_Handle Dart_GetInstanceFields(Dart_Handle object_in) {
DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target));
- // For backwards compatibility we allow class objects to be passed in
- // for now. This needs to be removed once all code that uses class
- // objects is removed.
- Class& cls = Class::Handle();
- if (obj.IsType()) {
- cls = Type::Cast(obj).type_class();
- } else if (obj.IsClass()) {
- cls = Class::Cast(obj).raw();
- } else {
+ const Type& type_obj = Api::UnwrapTypeHandle(isolate, target);
+ if (type_obj.IsNull()) {
return Api::NewError("%s expects argument 'target' to be a type",
CURRENT_FUNC);
}
+ const Class& cls = Class::Handle(isolate, type_obj.type_class());
return Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls));
}
@@ -514,10 +507,11 @@ DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in,
CURRENT_FUNC);
}
UNWRAP_AND_CHECK_PARAM(String, expr, expr_in);
- if (target.IsInstance()) {
+ if (target.IsType()) {
+ const Class& cls = Class::Handle(isolate, Type::Cast(target).type_class());
+ return Api::NewHandle(isolate, cls.Evaluate(expr));
+ } else if (target.IsInstance()) {
return Api::NewHandle(isolate, Instance::Cast(target).Evaluate(expr));
- } else if (target.IsClass()) {
- return Api::NewHandle(isolate, Class::Cast(target).Evaluate(expr));
} else if (target.IsLibrary()) {
return Api::NewHandle(isolate, Library::Cast(target).Evaluate(expr));
}
@@ -529,7 +523,7 @@ DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in);
- return Api::NewHandle(isolate, obj.clazz());
+ return Api::NewHandle(isolate, obj.GetType());
}
@@ -555,14 +549,6 @@ DART_EXPORT Dart_Handle Dart_GetClassFromId(intptr_t class_id) {
}
-DART_EXPORT Dart_Handle Dart_GetSuperclass(Dart_Handle cls_in) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- UNWRAP_AND_CHECK_PARAM(Class, cls, cls_in);
- return Api::NewHandle(isolate, cls.SuperClass());
-}
-
-
DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type_in) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698