diff --git a/src/executor/executor.cpp b/src/executor/executor.cpp index 9c4f1ec..0242eae 100644 --- a/src/executor/executor.cpp +++ b/src/executor/executor.cpp @@ -44,6 +44,12 @@ Value execute(Instruction inst) { if (inst.instruction == InstructionType::Assert) { return modules::assert(inst.args); } + + // For all other instructions, evaluate the arguments first + for(auto& arg : inst.args) { + arg = evaluate(arg); + } + if (inst.instruction == InstructionType::Variable) { auto& args = inst.args; @@ -235,11 +241,6 @@ Value execute(Instruction inst) { return Value(); } - // For all other instructions, evaluate the arguments first - for(auto& arg : inst.args) { - arg = evaluate(arg); - } - // Then, execute the instruction with the evaluated arguments switch (inst.instruction) { case InstructionType::Print: