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

Side by Side Diff: runtime/vm/debugger_api_impl.cc

Issue 25284003: Fix expression evaluation in library context (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 6
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 Isolate* isolate = Isolate::Current(); 500 Isolate* isolate = Isolate::Current();
501 DARTSCOPE(isolate); 501 DARTSCOPE(isolate);
502 502
503 const Object& target = Object::Handle(isolate, Api::UnwrapHandle(target_in)); 503 const Object& target = Object::Handle(isolate, Api::UnwrapHandle(target_in));
504 if (target.IsError()) return target_in; 504 if (target.IsError()) return target_in;
505 if (target.IsNull()) { 505 if (target.IsNull()) {
506 return Api::NewError("%s expects argument 'target' to be non-null", 506 return Api::NewError("%s expects argument 'target' to be non-null",
507 CURRENT_FUNC); 507 CURRENT_FUNC);
508 } 508 }
509 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); 509 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in);
510 // Type extends Instance, must check first.
510 if (target.IsType()) { 511 if (target.IsType()) {
511 const Class& cls = Class::Handle(isolate, Type::Cast(target).type_class()); 512 const Class& cls = Class::Handle(isolate, Type::Cast(target).type_class());
512 return Api::NewHandle(isolate, cls.Evaluate(expr)); 513 return Api::NewHandle(isolate, cls.Evaluate(expr));
513 } else if (target.IsInstance()) { 514 } else if (target.IsInstance()) {
514 return Api::NewHandle(isolate, Instance::Cast(target).Evaluate(expr)); 515 return Api::NewHandle(isolate, Instance::Cast(target).Evaluate(expr));
515 } else if (target.IsLibrary()) { 516 } else if (target.IsLibrary()) {
516 return Api::NewHandle(isolate, Library::Cast(target).Evaluate(expr)); 517 return Api::NewHandle(isolate, Library::Cast(target).Evaluate(expr));
518 } else if (target.IsClass()) {
519 return Api::NewHandle(isolate, Class::Cast(target).Evaluate(expr));
517 } 520 }
518 return Api::NewError("%s: unsupported target type", CURRENT_FUNC); 521 return Api::NewError("%s: unsupported target type", CURRENT_FUNC);
519 } 522 }
520 523
521 524
522 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { 525 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) {
523 Isolate* isolate = Isolate::Current(); 526 Isolate* isolate = Isolate::Current();
524 DARTSCOPE(isolate); 527 DARTSCOPE(isolate);
525 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); 528 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in);
526 return Api::NewHandle(isolate, obj.GetType()); 529 return Api::NewHandle(isolate, obj.GetType());
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 886
884 887
885 DART_EXPORT char* Dart_GetVmStatus(const char* request) { 888 DART_EXPORT char* Dart_GetVmStatus(const char* request) {
886 if (strncmp(request, "/isolate/", 9) == 0) { 889 if (strncmp(request, "/isolate/", 9) == 0) {
887 return Isolate::GetStatus(request); 890 return Isolate::GetStatus(request);
888 } 891 }
889 return NULL; 892 return NULL;
890 } 893 }
891 894
892 } // namespace dart 895 } // namespace dart
OLDNEW
« 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