Merge pull request #1959 from ktbee/declare-const-once

Declare const once to be reused in for loop
This commit is contained in:
Katie Broida 2019-02-25 15:57:52 -05:00 committed by GitHub
commit cff1c2c0a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1556,6 +1556,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;
@ -1602,8 +1604,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.