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

Unified Diff: runtime/vm/object.cc

Issue 2237953002: Fail gracefully when attempting to evaluate against a VM internal class such a Field. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 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
« no previous file with comments | « runtime/observatory/tests/service/eval_internal_class_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 0886a30ee2dca5a75bbf024e7550dc68db4a360f..003f0b80ddbcdd2c6eec28d4f264f11eec9aebfb 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3088,6 +3088,13 @@ RawObject* Class::Evaluate(const String& expr,
const Array& param_names,
const Array& param_values) const {
ASSERT(Thread::Current()->IsMutatorThread());
+ if (id() < kInstanceCid) {
+ const Instance& exception = Instance::Handle(String::New(
+ "Cannot evaluate against a VM internal class"));
+ const Instance& stacktrace = Instance::Handle();
+ return UnhandledException::New(exception, stacktrace);
+ }
+
const Function& eval_func =
Function::Handle(EvaluateHelper(*this, expr, param_names, true));
const Object& result =
« no previous file with comments | « runtime/observatory/tests/service/eval_internal_class_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698