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

Unified Diff: runtime/vm/debugger.cc

Issue 2872503004: vm-service: Add optional 'scope' parameter to 'evaluate' and 'evaluateInFrame'. (Closed)
Patch Set: review Created 3 years, 7 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/vm/debugger.h ('k') | runtime/vm/debugger_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index acf03220b05c6c26d089bb02fcfe20171c11b102..5f14a55b5d82ae539b3440296112a5859ed59bce 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -1290,13 +1290,12 @@ static bool IsPrivateVariableName(const String& var_name) {
}
-RawObject* ActivationFrame::Evaluate(const String& expr) {
+RawObject* ActivationFrame::Evaluate(const String& expr,
+ const GrowableObjectArray& param_names,
+ const GrowableObjectArray& param_values) {
GetDescIndices();
- const GrowableObjectArray& param_names =
- GrowableObjectArray::Handle(GrowableObjectArray::New());
- const GrowableObjectArray& param_values =
- GrowableObjectArray::Handle(GrowableObjectArray::New());
String& name = String::Handle();
+ String& existing_name = String::Handle();
Object& value = Instance::Handle();
intptr_t num_variables = desc_indices_.length();
for (intptr_t i = 0; i < num_variables; i++) {
@@ -1306,8 +1305,21 @@ RawObject* ActivationFrame::Evaluate(const String& expr) {
if (IsPrivateVariableName(name)) {
name = String::ScrubName(name);
}
- param_names.Add(name);
- param_values.Add(value);
+ bool conflict = false;
+ for (intptr_t j = 0; j < param_names.Length(); j++) {
+ existing_name ^= param_names.At(j);
+ if (name.Equals(existing_name)) {
+ conflict = true;
+ break;
+ }
+ }
+ // If local has the same name as a binding in the incoming scope, prefer
+ // the one from the incoming scope, since it is logically a child scope
+ // of the activation's current scope.
+ if (!conflict) {
+ param_names.Add(name);
+ param_values.Add(value);
+ }
}
}
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/debugger_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698