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

Unified Diff: runtime/vm/debugger_api_impl.cc

Issue 23102019: Evaluate expression in the context of a class (Closed) Base URL: http://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/vm/debugger_api_impl.cc
===================================================================
--- runtime/vm/debugger_api_impl.cc (revision 26604)
+++ runtime/vm/debugger_api_impl.cc (working copy)
@@ -465,7 +465,7 @@
} else if (obj.IsClass()) {
cls = Class::Cast(obj).raw();
} else {
- return Api::NewError("%s expects argument 'target' to be a type.",
+ return Api::NewError("%s expects argument 'target' to be a type",
CURRENT_FUNC);
}
return Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls));
@@ -498,13 +498,24 @@
}
-DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target,
+DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in,
Dart_Handle expr_in) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- UNWRAP_AND_CHECK_PARAM(Instance, obj, target);
+
+ const Object& target = Object::Handle(isolate, Api::UnwrapHandle(target_in));
+ if (target.IsError()) return target_in;
+ if (target.IsNull()) {
+ return Api::NewError("%s expects argument 'target' to be non-null",
+ CURRENT_FUNC);
+ }
UNWRAP_AND_CHECK_PARAM(String, expr, expr_in);
- return Api::NewHandle(isolate, obj.Evaluate(expr));
+ 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));
+ }
+ return Api::NewError("%s: unsupported target type", CURRENT_FUNC);
}
@@ -527,6 +538,17 @@
}
+DART_EXPORT Dart_Handle Dart_GetClassFromId(intptr_t class_id) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ if (!isolate->class_table()->IsValidIndex(class_id)) {
+ return Api::NewError("%s: %" Pd " is not a valid class id",
+ CURRENT_FUNC, class_id);
+ }
+ return Api::NewHandle(isolate, isolate->class_table()->At(class_id));
+}
+
+
DART_EXPORT Dart_Handle Dart_GetSuperclass(Dart_Handle cls_in) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
« no previous file with comments | « runtime/include/dart_debugger_api.h ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698