Simplified file structure
This commit is contained in:
24
src/core/JumpIfFalse.go
Normal file
24
src/core/JumpIfFalse.go
Normal file
@ -0,0 +1,24 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/asm"
|
||||
"git.akyoto.dev/cli/q/src/token"
|
||||
)
|
||||
|
||||
// JumpIfFalse jumps to the label if the previous comparison was false.
|
||||
func (f *Function) JumpIfFalse(operator token.Kind, label string) {
|
||||
switch operator {
|
||||
case token.Equal:
|
||||
f.Jump(asm.JNE, label)
|
||||
case token.NotEqual:
|
||||
f.Jump(asm.JE, label)
|
||||
case token.Greater:
|
||||
f.Jump(asm.JLE, label)
|
||||
case token.Less:
|
||||
f.Jump(asm.JGE, label)
|
||||
case token.GreaterEqual:
|
||||
f.Jump(asm.JL, label)
|
||||
case token.LessEqual:
|
||||
f.Jump(asm.JG, label)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user