Added scope package
This commit is contained in:
parent
fd66296826
commit
8e725da9c6
37 changed files with 416 additions and 371 deletions
23
src/build/core/JumpIfTrue.go
Normal file
23
src/build/core/JumpIfTrue.go
Normal 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)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue