mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Refactor Thread.peekParentStackFrame
This commit is contained in:
parent
bed3e28c02
commit
6181bcd5cb
1 changed files with 9 additions and 1 deletions
|
@ -103,12 +103,20 @@ Thread.prototype.peekStackFrame = function () {
|
||||||
return this.stackFrames[this.stackFrames.length - 1];
|
return this.stackFrames[this.stackFrames.length - 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get stack frame above the current top.
|
||||||
|
* @return {?Object} Second to last stack frame stored on this thread.
|
||||||
|
*/
|
||||||
|
Thread.prototype.peekParentStackFrame = function () {
|
||||||
|
return this.stackFrames[this.stackFrames.length - 2];
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push a reported value to the parent of the current stack frame.
|
* Push a reported value to the parent of the current stack frame.
|
||||||
* @param {!Any} value Reported value to push.
|
* @param {!Any} value Reported value to push.
|
||||||
*/
|
*/
|
||||||
Thread.prototype.pushReportedValue = function (value) {
|
Thread.prototype.pushReportedValue = function (value) {
|
||||||
var parentStackFrame = this.stackFrames[this.stackFrames.length - 2];
|
var parentStackFrame = this.peekParentStackFrame();
|
||||||
if (parentStackFrame) {
|
if (parentStackFrame) {
|
||||||
var waitingReporter = parentStackFrame.waitingReporter;
|
var waitingReporter = parentStackFrame.waitingReporter;
|
||||||
parentStackFrame.reported[waitingReporter] = value;
|
parentStackFrame.reported[waitingReporter] = value;
|
||||||
|
|
Loading…
Reference in a new issue