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

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: . 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
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..eb88de83131174a6aea069cebab35a3f64f7ecf7 100644
--- a/runtime/vm/debugger_api_impl.cc
+++ b/runtime/vm/debugger_api_impl.cc
@@ -460,14 +460,9 @@ DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target));
siva 2013/09/19 03:16:58 Ditto comment about using const Type& type_obj = A
- // 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 {
return Api::NewError("%s expects argument 'target' to be a type",
CURRENT_FUNC);
@@ -514,10 +509,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 +525,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 +551,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);

Powered by Google App Engine
This is Rietveld 408576698