Fix remaining no-var and no-use-before-define's

This commit is contained in:
Ray Schamp 2017-04-17 17:15:19 -04:00
parent e01c4ae108
commit 4455b0694f
8 changed files with 218 additions and 203 deletions
src/engine

View file

@ -15,7 +15,7 @@ const isPromise = function (value) {
* @param {!Sequencer} sequencer Which sequencer is executing.
* @param {!Thread} thread Thread which to read and execute.
*/
var execute = function (sequencer, thread) {
const execute = function (sequencer, thread) {
const runtime = sequencer.runtime;
const target = thread.target;
@ -228,6 +228,8 @@ var execute = function (sequencer, thread) {
primitiveReportedValue.then(resolvedValue => {
handleReport(resolvedValue);
if (typeof resolvedValue === 'undefined') {
let stackFrame;
let nextBlockId;
do {
// In the case that the promise is the last block in the current thread stack
// We need to pop out repeatedly until we find the next block.
@ -235,14 +237,14 @@ var execute = function (sequencer, thread) {
if (popped === null) {
return;
}
var nextBlockId = thread.target.blocks.getNextBlock(popped);
nextBlockId = thread.target.blocks.getNextBlock(popped);
if (nextBlockId !== null) {
// A next block exists so break out this loop
break;
}
// Investigate the next block and if not in a loop,
// then repeat and pop the next item off the stack frame
var stackFrame = thread.peekStackFrame();
stackFrame = thread.peekStackFrame();
} while (stackFrame !== null && !stackFrame.isLoop);
thread.pushStack(nextBlockId);