Declare const once to be resused in for loop

This commit is contained in:
Katie Broida 2019-01-29 10:47:54 -05:00
parent c5abcf5888
commit 356a4e7880

View file

@ -1461,6 +1461,8 @@ class Runtime extends EventEmitter {
} }
const instance = this; const instance = this;
const newThreads = []; const newThreads = [];
// Look up metadata for the relevant hat.
const hatMeta = instance._hats[requestedHatOpcode];
for (const opts in optMatchFields) { for (const opts in optMatchFields) {
if (!optMatchFields.hasOwnProperty(opts)) continue; if (!optMatchFields.hasOwnProperty(opts)) continue;
@ -1507,8 +1509,6 @@ class Runtime extends EventEmitter {
} }
} }
// Look up metadata for the relevant hat.
const hatMeta = instance._hats[requestedHatOpcode];
if (hatMeta.restartExistingThreads) { if (hatMeta.restartExistingThreads) {
// If `restartExistingThreads` is true, we should stop // If `restartExistingThreads` is true, we should stop
// any existing threads starting with the top block. // any existing threads starting with the top block.