Chromium Code Reviews| Index: src/mirror-debugger.js |
| diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js |
| index 212bb0b9cac370b734011add6baa5a95fef593b5..6182d9de15b764d7e8a73c88685ca8f50d847cd2 100644 |
| --- a/src/mirror-debugger.js |
| +++ b/src/mirror-debugger.js |
| @@ -1675,6 +1675,18 @@ FrameMirror.prototype.scope = function(index) { |
| }; |
| +FrameMirror.prototype.allScopes = function() { |
| + var scopeDetails = %GetAllScopesDetails(this.break_id_, |
| + this.details_.frameId(), |
| + this.details_.inlinedFrameIndex()); |
| + var result = []; |
| + for (var i = 0; i < scopeDetails.length; ++i) { |
| + result.push(new ScopeMirror(this, UNDEFINED, i, scopeDetails[i])); |
| + } |
| + return result; |
| +}; |
| + |
| + |
| FrameMirror.prototype.stepInPositions = function() { |
| var script = this.func().script(); |
| var funcOffset = this.func().sourcePosition_(); |
| @@ -1865,17 +1877,18 @@ FrameMirror.prototype.toText = function(opt_locals) { |
| var kScopeDetailsTypeIndex = 0; |
| var kScopeDetailsObjectIndex = 1; |
| -function ScopeDetails(frame, fun, index) { |
| +function ScopeDetails(frame, fun, index, opt_details) { |
| if (frame) { |
| this.break_id_ = frame.break_id_; |
| - this.details_ = %GetScopeDetails(frame.break_id_, |
| + this.details_ = opt_details || |
| + %GetScopeDetails(frame.break_id_, |
| frame.details_.frameId(), |
| frame.details_.inlinedFrameIndex(), |
| index); |
| this.frame_id_ = frame.details_.frameId(); |
| this.inlined_frame_id_ = frame.details_.inlinedFrameIndex(); |
| } else { |
| - this.details_ = %GetFunctionScopeDetails(fun.value(), index); |
| + this.details_ = opt_details || %GetFunctionScopeDetails(fun.value(), index); |
| this.fun_value_ = fun.value(); |
| this.break_id_ = undefined; |
| } |
| @@ -1921,10 +1934,11 @@ ScopeDetails.prototype.setVariableValueImpl = function(name, new_value) { |
| * @param {FrameMirror} frame The frame this scope is a part of |
| * @param {FunctionMirror} function The function this scope is a part of |
| * @param {number} index The scope index in the frame |
| + * @param {Array=} opt_details Raw scope details data |
| * @constructor |
| * @extends Mirror |
| */ |
| -function ScopeMirror(frame, function, index) { |
| +function ScopeMirror(frame, function, index, opt_details) { |
|
ulan
2014/03/04 10:41:59
Maybe just "details" instead of "opt_details". "op
aandrey
2014/03/04 11:04:19
Yes, it means "optional", and we do use "opt_" pre
ulan
2014/03/04 11:28:15
In that case it is OK.
Yang
2014/03/04 11:31:35
I think it's fine in this context.
|
| %_CallFunction(this, SCOPE_TYPE, Mirror); |
| if (frame) { |
| this.frame_index_ = frame.index_; |
| @@ -1932,7 +1946,7 @@ function ScopeMirror(frame, function, index) { |
| this.frame_index_ = undefined; |
| } |
| this.scope_index_ = index; |
| - this.details_ = new ScopeDetails(frame, function, index); |
| + this.details_ = new ScopeDetails(frame, function, index, opt_details); |
| } |
| inherits(ScopeMirror, Mirror); |