Simplified file structure
This commit is contained in:
parent
cacee7260a
commit
a466281307
219 changed files with 453 additions and 457 deletions
24
src/core/JumpIfTrue.go
Normal file
24
src/core/JumpIfTrue.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/asm"
|
||||
"git.akyoto.dev/cli/q/src/token"
|
||||
)
|
||||
|
||||
// JumpIfTrue jumps to the label if the previous comparison was true.
|
||||
func (f *Function) JumpIfTrue(operator token.Kind, label string) {
|
||||
switch operator {
|
||||
case token.Equal:
|
||||
f.Jump(asm.JE, label)
|
||||
case token.NotEqual:
|
||||
f.Jump(asm.JNE, label)
|
||||
case token.Greater:
|
||||
f.Jump(asm.JG, label)
|
||||
case token.Less:
|
||||
f.Jump(asm.JL, label)
|
||||
case token.GreaterEqual:
|
||||
f.Jump(asm.JGE, label)
|
||||
case token.LessEqual:
|
||||
f.Jump(asm.JLE, label)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue