Added scope package

This commit is contained in:
Eduard Urbach 2024-07-20 23:20:23 +02:00
parent fd66296826
commit 8e725da9c6
Signed by: eduard
GPG key ID: 49226B848C78F6C8
37 changed files with 416 additions and 371 deletions

View file

@ -0,0 +1,23 @@
package core
import (
"git.akyoto.dev/cli/q/src/build/asm"
)
// 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)
}
}