From 2f6f1937a97d42c936fb38aed03d6f023bcaf137 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Tue, 9 Jul 2019 08:16:16 -0700 Subject: [PATCH] Inline calculating position --- experiments/modern/src/maki-interpreter/parser.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/experiments/modern/src/maki-interpreter/parser.js b/experiments/modern/src/maki-interpreter/parser.js index 24b0b4bf..6db86da7 100644 --- a/experiments/modern/src/maki-interpreter/parser.js +++ b/experiments/modern/src/maki-interpreter/parser.js @@ -202,19 +202,11 @@ function decodeCode({ makiFile, classes, variables, methods }) { const length = makiFile.readUInt32LE(); const start = makiFile.getPosition(); - function getPos() { - return makiFile.getPosition() - start; - } const localFunctions = {}; const commands = []; while (makiFile.getPosition() < start + length) { - const command = parseComand({ - makiFile, - length, - pos: getPos(), - localFunctions, - }); - commands.push(command); + const pos = makiFile.getPosition() - start; + commands.push(parseComand({ makiFile, length, pos, localFunctions })); } return { commands, localFunctions };