Browse Source

Fix: compiler (less than or equal)

AnnulusGames 1 year ago
parent
commit
d0fbd4bb0e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Lua/CodeAnalysis/Compilation/LuaCompiler.cs

+ 2 - 2
src/Lua/CodeAnalysis/Compilation/LuaCompiler.cs

@@ -830,7 +830,7 @@ public sealed class LuaCompiler : ISyntaxNodeVisitor<ScopeCompilationContext, bo
         // set JMP sBx
         // set JMP sBx
         context.Function.Instructions[conditionIndex].SBx = context.Function.Instructions.Length - 1 - conditionIndex;
         context.Function.Instructions[conditionIndex].SBx = context.Function.Instructions.Length - 1 - conditionIndex;
 
 
-        CompileConditionNode(node.ConditionNode, context, true);
+        CompileConditionNode(node.ConditionNode, context, false);
         var a = scopeContext.HasCapturedLocalVariables ? scopeContext.StackTopPosition : (byte)0;
         var a = scopeContext.HasCapturedLocalVariables ? scopeContext.StackTopPosition : (byte)0;
         context.PushInstruction(Instruction.Jmp(a, conditionIndex - context.Function.Instructions.Length), node.Position);
         context.PushInstruction(Instruction.Jmp(a, conditionIndex - context.Function.Instructions.Length), node.Position);
 
 
@@ -1054,7 +1054,7 @@ public sealed class LuaCompiler : ISyntaxNodeVisitor<ScopeCompilationContext, bo
                 case BinaryOperator.LessThanOrEqual:
                 case BinaryOperator.LessThanOrEqual:
                     {
                     {
                         (var b, var c) = GetBAndC(binaryExpression, context);
                         (var b, var c) = GetBAndC(binaryExpression, context);
-                        context.PushInstruction(Instruction.Le(falseIsSkip ? (byte)1 : (byte)0, b, c), node.Position);
+                        context.PushInstruction(Instruction.Le(falseIsSkip ? (byte)0 : (byte)1, b, c), node.Position);
                         return;
                         return;
                     }
                     }
                 case BinaryOperator.GreaterThan:
                 case BinaryOperator.GreaterThan: