Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/debugger.h" | 5 #include "vm/debugger.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1021 intptr_t ignore; | 1021 intptr_t ignore; |
| 1022 VariableAt(i, &var_name, &ignore, &ignore, &value); | 1022 VariableAt(i, &var_name, &ignore, &ignore, &value); |
| 1023 if (var_name.Equals(Symbols::This())) { | 1023 if (var_name.Equals(Symbols::This())) { |
| 1024 return value.raw(); | 1024 return value.raw(); |
| 1025 } | 1025 } |
| 1026 } | 1026 } |
| 1027 return Object::null(); | 1027 return Object::null(); |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 | 1030 |
| 1031 bool IsPrivateVariableName(const String& var_name) { | |
|
rmacnak
2015/10/07 18:06:21
Library::IsPrivate already exists and handles more
| |
| 1032 return (var_name.Length() >= 1) && (var_name.CharAt(0) == '_'); | |
| 1033 } | |
| 1034 | |
| 1035 | |
| 1031 RawObject* ActivationFrame::Evaluate(const String& expr) { | 1036 RawObject* ActivationFrame::Evaluate(const String& expr) { |
| 1032 GetDescIndices(); | 1037 GetDescIndices(); |
| 1033 const GrowableObjectArray& param_names = | 1038 const GrowableObjectArray& param_names = |
| 1034 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 1039 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 1035 const GrowableObjectArray& param_values = | 1040 const GrowableObjectArray& param_values = |
| 1036 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 1041 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 1037 String& name = String::Handle(); | 1042 String& name = String::Handle(); |
| 1038 Object& value = Instance::Handle(); | 1043 Object& value = Instance::Handle(); |
| 1039 intptr_t num_variables = desc_indices_.length(); | 1044 intptr_t num_variables = desc_indices_.length(); |
| 1040 for (intptr_t i = 0; i < num_variables; i++) { | 1045 for (intptr_t i = 0; i < num_variables; i++) { |
| 1041 intptr_t ignore; | 1046 intptr_t ignore; |
| 1042 VariableAt(i, &name, &ignore, &ignore, &value); | 1047 VariableAt(i, &name, &ignore, &ignore, &value); |
| 1043 if (!name.Equals(Symbols::This())) { | 1048 if (!name.Equals(Symbols::This())) { |
| 1049 if (IsPrivateVariableName(name)) { | |
| 1050 name = String::IdentifierPrettyName(name); | |
| 1051 } | |
| 1044 param_names.Add(name); | 1052 param_names.Add(name); |
| 1045 param_values.Add(value); | 1053 param_values.Add(value); |
| 1046 } | 1054 } |
| 1047 } | 1055 } |
| 1048 | 1056 |
| 1049 if (function().is_static()) { | 1057 if (function().is_static()) { |
| 1050 const Class& cls = Class::Handle(function().Owner()); | 1058 const Class& cls = Class::Handle(function().Owner()); |
| 1051 return cls.Evaluate(expr, | 1059 return cls.Evaluate(expr, |
| 1052 Array::Handle(Array::MakeArray(param_names)), | 1060 Array::Handle(Array::MakeArray(param_names)), |
| 1053 Array::Handle(Array::MakeArray(param_values))); | 1061 Array::Handle(Array::MakeArray(param_values))); |
| (...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3226 } | 3234 } |
| 3227 | 3235 |
| 3228 | 3236 |
| 3229 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3237 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 3230 ASSERT(bpt->next() == NULL); | 3238 ASSERT(bpt->next() == NULL); |
| 3231 bpt->set_next(code_breakpoints_); | 3239 bpt->set_next(code_breakpoints_); |
| 3232 code_breakpoints_ = bpt; | 3240 code_breakpoints_ = bpt; |
| 3233 } | 3241 } |
| 3234 | 3242 |
| 3235 } // namespace dart | 3243 } // namespace dart |
| OLD | NEW |