From 05362da4a38f96924939f42aa2bdde68841b8f16 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 14 Jul 2019 15:45:04 -0700 Subject: [PATCH] Be consistent with ordering of a and b, even when it does not matter Interestingly this changes the order of << but tests still pass --- experiments/modern/src/maki-interpreter/virtualMachine.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/experiments/modern/src/maki-interpreter/virtualMachine.js b/experiments/modern/src/maki-interpreter/virtualMachine.js index 17fad1dc..1364cd1b 100644 --- a/experiments/modern/src/maki-interpreter/virtualMachine.js +++ b/experiments/modern/src/maki-interpreter/virtualMachine.js @@ -49,7 +49,7 @@ async function interpret(start, program, stack = [], { logger = null }) { let aValue = a instanceof Variable ? a.getValue() : a; let bValue = b instanceof Variable ? b.getValue() : b; aValue = coerceTypes(a, b, aValue, bValue); - stack.push(aValue === bValue); + stack.push(bValue === aValue); break; } // != @@ -59,7 +59,7 @@ async function interpret(start, program, stack = [], { logger = null }) { let aValue = a instanceof Variable ? a.getValue() : a; let bValue = b instanceof Variable ? b.getValue() : b; aValue = coerceTypes(a, b, aValue, bValue); - stack.push(aValue !== bValue); + stack.push(bValue !== aValue); break; } // > @@ -214,7 +214,7 @@ async function interpret(start, program, stack = [], { logger = null }) { case 64: { const a = stack.pop(); const b = stack.pop(); - stack.push(a.getValue() + b.getValue()); + stack.push(b.getValue() + a.getValue()); break; } // - (subtract) @@ -322,7 +322,7 @@ async function interpret(start, program, stack = [], { logger = null }) { const b = stack.pop(); const aValue = a instanceof Variable ? a.getValue() : a; const bValue = b instanceof Variable ? b.getValue() : b; - stack.push(aValue << bValue); + stack.push(bValue << aValue); break; } // >>