Skip to content

Commit

Permalink
fix(zscript): code gen for range loop using wrong op
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed May 3, 2024
1 parent 843daca commit 2133615
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser/BuildVisitors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ void BuildOpcodes::caseStmtRangeLoop(ASTStmtRangeLoop &host, void *param)
//...now, we need to check that we didn't ALREADY just run that value exactly
addOpcode(new OPeekAtImmediate(new VarArgument(EXP2), new LiteralArgument(mgr.at(*overflow_peekind))));
if(targv)
addOpcode(new OCompareRegister(new VarArgument(EXP2), new LiteralArgument(*targv)));
addOpcode(new OCompareImmediate(new VarArgument(EXP2), new LiteralArgument(*targv)));
else addOpcode(new OCompareRegister(new VarArgument(EXP2), new VarArgument(EXP1)));
addOpcode(new OGotoCompare(new LabelArgument(elselabel), new CompareArgument(CMP_EQ)));
//If we haven't run the value yet, set it and run the loop one last time
Expand Down

0 comments on commit 2133615

Please sign in to comment.