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

Side by Side 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 unified diff | 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 »
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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after
3081 func.SetNumOptionalParameters(0, true); 3081 func.SetNumOptionalParameters(0, true);
3082 func.SetIsOptimizable(false); 3082 func.SetIsOptimizable(false);
3083 return func.raw(); 3083 return func.raw();
3084 } 3084 }
3085 3085
3086 3086
3087 RawObject* Class::Evaluate(const String& expr, 3087 RawObject* Class::Evaluate(const String& expr,
3088 const Array& param_names, 3088 const Array& param_names,
3089 const Array& param_values) const { 3089 const Array& param_values) const {
3090 ASSERT(Thread::Current()->IsMutatorThread()); 3090 ASSERT(Thread::Current()->IsMutatorThread());
3091 if (id() < kInstanceCid) {
3092 const Instance& exception = Instance::Handle(String::New(
3093 "Cannot evaluate against a VM internal class"));
3094 const Instance& stacktrace = Instance::Handle();
3095 return UnhandledException::New(exception, stacktrace);
3096 }
3097
3091 const Function& eval_func = 3098 const Function& eval_func =
3092 Function::Handle(EvaluateHelper(*this, expr, param_names, true)); 3099 Function::Handle(EvaluateHelper(*this, expr, param_names, true));
3093 const Object& result = 3100 const Object& result =
3094 Object::Handle(DartEntry::InvokeFunction(eval_func, param_values)); 3101 Object::Handle(DartEntry::InvokeFunction(eval_func, param_values));
3095 return result.raw(); 3102 return result.raw();
3096 } 3103 }
3097 3104
3098 3105
3099 // Ensure that top level parsing of the class has been done. 3106 // Ensure that top level parsing of the class has been done.
3100 RawError* Class::EnsureIsFinalized(Thread* thread) const { 3107 RawError* Class::EnsureIsFinalized(Thread* thread) const {
(...skipping 19605 matching lines...) Expand 10 before | Expand all | Expand 10 after
22706 return UserTag::null(); 22713 return UserTag::null();
22707 } 22714 }
22708 22715
22709 22716
22710 const char* UserTag::ToCString() const { 22717 const char* UserTag::ToCString() const {
22711 const String& tag_label = String::Handle(label()); 22718 const String& tag_label = String::Handle(label());
22712 return tag_label.ToCString(); 22719 return tag_label.ToCString();
22713 } 22720 }
22714 22721
22715 } // namespace dart 22722 } // namespace dart
OLDNEW
« 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