mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-11 13:34:00 -04:00
Merge pull request #1341 from mzgoddard/fix-report
fix unnecessary stackClick report from nested promise reporters
This commit is contained in:
commit
c428e2ec02
1 changed files with 7 additions and 7 deletions
|
@ -50,7 +50,7 @@ const isPromise = function (value) {
|
|||
*/
|
||||
// @todo move this to callback attached to the thread when we have performance
|
||||
// metrics (dd)
|
||||
const handleReport = function (resolvedValue, sequencer, thread, blockCached) {
|
||||
const handleReport = function (resolvedValue, sequencer, thread, blockCached, lastOperation) {
|
||||
const currentBlockId = blockCached.id;
|
||||
const opcode = blockCached.opcode;
|
||||
const isHat = blockCached._isHat;
|
||||
|
@ -80,7 +80,7 @@ const handleReport = function (resolvedValue, sequencer, thread, blockCached) {
|
|||
} else {
|
||||
// In a non-hat, report the value visually if necessary if
|
||||
// at the top of the thread stack.
|
||||
if (typeof resolvedValue !== 'undefined' && thread.atStackTop()) {
|
||||
if (lastOperation && typeof resolvedValue !== 'undefined' && thread.atStackTop()) {
|
||||
if (thread.stackClick) {
|
||||
sequencer.runtime.visualReport(currentBlockId, resolvedValue);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ const handlePromise = (primitiveReportedValue, sequencer, thread, blockCached, l
|
|||
}
|
||||
// Promise handlers
|
||||
primitiveReportedValue.then(resolvedValue => {
|
||||
handleReport(resolvedValue, sequencer, thread, blockCached);
|
||||
handleReport(resolvedValue, sequencer, thread, blockCached, lastOperation);
|
||||
// If its a command block.
|
||||
if (lastOperation && typeof resolvedValue === 'undefined') {
|
||||
let stackFrame;
|
||||
|
@ -465,7 +465,7 @@ const execute = function (sequencer, thread) {
|
|||
}
|
||||
|
||||
for (; i < length; i++) {
|
||||
const last = i === length - 1;
|
||||
const lastOperation = i === length - 1;
|
||||
const opCached = ops[i];
|
||||
|
||||
const blockFunction = opCached._blockFunction;
|
||||
|
@ -501,7 +501,7 @@ const execute = function (sequencer, thread) {
|
|||
|
||||
// If it's a promise, wait until promise resolves.
|
||||
if (isPromise(primitiveReportedValue)) {
|
||||
handlePromise(primitiveReportedValue, sequencer, thread, opCached, last);
|
||||
handlePromise(primitiveReportedValue, sequencer, thread, opCached, lastOperation);
|
||||
|
||||
// Store the already reported values. They will be thawed into the
|
||||
// future versions of the same operations by block id. The reporting
|
||||
|
@ -529,7 +529,7 @@ const execute = function (sequencer, thread) {
|
|||
// and continue them later after thawing the reported values.
|
||||
break;
|
||||
} else if (thread.status === Thread.STATUS_RUNNING) {
|
||||
if (last) {
|
||||
if (lastOperation) {
|
||||
if (typeof primitiveReportedValue === 'undefined') {
|
||||
// No value reported - potentially a command block.
|
||||
// Edge-activated hats don't request a glow; all
|
||||
|
@ -537,7 +537,7 @@ const execute = function (sequencer, thread) {
|
|||
thread.requestScriptGlowInFrame = true;
|
||||
}
|
||||
|
||||
handleReport(primitiveReportedValue, sequencer, thread, opCached);
|
||||
handleReport(primitiveReportedValue, sequencer, thread, opCached, lastOperation);
|
||||
} else {
|
||||
// By definition a block that is not last in the list has a
|
||||
// parent.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue