Only visually report when an actual value was returned

This commit is contained in:
Tim Mickel 2016-07-07 19:44:26 -04:00
parent 9c6dca8131
commit 1f19d7a209

View file

@ -97,7 +97,8 @@ var execute = function (sequencer, thread) {
// Promise resolved: the primitive reported a value. // Promise resolved: the primitive reported a value.
thread.pushReportedValue(resolvedValue); thread.pushReportedValue(resolvedValue);
// Report the value visually if necessary. // Report the value visually if necessary.
if (thread.peekStack() === thread.topBlock) { if (typeof resolvedValue !== 'undefined' &&
thread.peekStack() === thread.topBlock) {
runtime.visualReport(thread.peekStack(), resolvedValue); runtime.visualReport(thread.peekStack(), resolvedValue);
} }
thread.setStatus(Thread.STATUS_RUNNING); thread.setStatus(Thread.STATUS_RUNNING);
@ -112,7 +113,8 @@ var execute = function (sequencer, thread) {
} else if (thread.status === Thread.STATUS_RUNNING) { } else if (thread.status === Thread.STATUS_RUNNING) {
thread.pushReportedValue(primitiveReportedValue); thread.pushReportedValue(primitiveReportedValue);
// Report the value visually if necessary. // Report the value visually if necessary.
if (thread.peekStack() === thread.topBlock) { if (typeof primitiveReportedValue !== 'undefined' &&
thread.peekStack() === thread.topBlock) {
runtime.visualReport(thread.peekStack(), primitiveReportedValue); runtime.visualReport(thread.peekStack(), primitiveReportedValue);
} }
} }