Added scope package
This commit is contained in:
@ -3,7 +3,6 @@ package core
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/build/asm"
|
||||
"git.akyoto.dev/cli/q/src/build/expression"
|
||||
)
|
||||
|
||||
@ -74,39 +73,3 @@ func (f *Function) CompileCondition(condition *expression.Expression, successLab
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// JumpIfFalse jumps to the label if the previous comparison was false.
|
||||
func (f *Function) JumpIfFalse(operator string, label string) {
|
||||
switch operator {
|
||||
case "==":
|
||||
f.Jump(asm.JNE, label)
|
||||
case "!=":
|
||||
f.Jump(asm.JE, label)
|
||||
case ">":
|
||||
f.Jump(asm.JLE, label)
|
||||
case "<":
|
||||
f.Jump(asm.JGE, label)
|
||||
case ">=":
|
||||
f.Jump(asm.JL, label)
|
||||
case "<=":
|
||||
f.Jump(asm.JG, label)
|
||||
}
|
||||
}
|
||||
|
||||
// JumpIfTrue jumps to the label if the previous comparison was true.
|
||||
func (f *Function) JumpIfTrue(operator string, label string) {
|
||||
switch operator {
|
||||
case "==":
|
||||
f.Jump(asm.JE, label)
|
||||
case "!=":
|
||||
f.Jump(asm.JNE, label)
|
||||
case ">":
|
||||
f.Jump(asm.JG, label)
|
||||
case "<":
|
||||
f.Jump(asm.JL, label)
|
||||
case ">=":
|
||||
f.Jump(asm.JGE, label)
|
||||
case "<=":
|
||||
f.Jump(asm.JLE, label)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user