Added label type

This commit is contained in:
2025-03-13 16:57:13 +01:00
parent d96c351b4b
commit c1913d99d0
32 changed files with 102 additions and 63 deletions

View File

@ -8,8 +8,8 @@ import (
// CompileAssert compiles an assertion.
func (f *Function) CompileAssert(assert *ast.Assert) error {
f.count.assert++
success := f.CreateLabel("assert true", f.count.assert)
fail := f.CreateLabel("assert false", f.count.assert)
success := f.CreateLabel("assert true", f.count.assert, asm.ControlLabel)
fail := f.CreateLabel("assert false", f.count.assert, asm.ControlLabel)
err := f.CompileCondition(assert.Condition, success, fail)
if err != nil {
@ -20,7 +20,7 @@ func (f *Function) CompileAssert(assert *ast.Assert) error {
f.Defer(func() {
f.AddLabel(fail)
f.Jump(asm.JUMP, "_crash")
f.Jump(asm.JUMP, asm.Label{Name: "_crash", Type: asm.ControlLabel})
})
return err