Skip to content

Commit

Permalink
don't fix div_zero4.dm
Browse files Browse the repository at this point in the history
  • Loading branch information
ike709 committed Dec 30, 2024
1 parent 42a93b2 commit a3db5ae
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions DMCompiler/Optimizer/PeepholeOptimizations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,6 @@ public void Apply(DMCompiler compiler, List<IAnnotatedBytecode> input, int index

IOptimization.GetInstructionAndValue(input[index + 1], out var pushVal2);

if (pushVal2 == 0) {
compiler.Emit(WarningCode.BadExpression, input[index + 1].GetLocation(), "Division by zero");
}

// At runtime, given "A / B" we pop B then A
// In the peephole optimizer, index is "A", index+1 is "B"
var args = new List<IAnnotatedBytecode>(1) {new AnnotatedBytecodeFloat(pushVal1 / pushVal2, firstInstruction.Location)};
Expand Down

0 comments on commit a3db5ae

Please sign in to comment.