generate: Remove abort parameter

This commit is contained in:
Sasha Koshka 2025-08-03 22:27:14 -04:00
parent 41b3376fa3
commit df3fe1280d

View File

@ -146,7 +146,7 @@ func (this *Generator) generateTypedef(name string, typ Type) (n int, err error)
this.push()
nn, err = this.iprintf("var nn int\n")
n += nn; if err != nil { return n, err }
nn, err = this.generateDecodeValue(typ, "this", "tag", "return n, nil")
nn, err = this.generateDecodeValue(typ, "this", "tag")
n += nn; if err != nil { return n, err }
nn, err = this.iprintf("return n, nil\n")
n += nn; if err != nil { return n, err }
@ -217,20 +217,16 @@ func (this *Generator) generateMessage(method uint16, message Message) (n int, e
n += nn; if err != nil { return n, err }
nn, err = this.generateErrorCheck()
n += nn; if err != nil { return n, err }
abort := "return n, nil" // TODO: skip value somehow
nn, err = this.iprintf("if !tag.Is(")
n += nn; if err != nil { return n, err }
nn, err = this.generateTN(message.Type)
n += nn; if err != nil { return n, err }
nn, err = this.printf(") {\n")
n += nn; if err != nil { return n, err }
this.push()
nn, err = this.iprintf("%s\n", abort)
n += nn; if err != nil { return n, err }
this.pop()
// TODO skip value using the correct TAPE function and return
nn, err = this.iprintf("}\n")
n += nn; if err != nil { return n, err }
nn, err = this.generateDecodeValue(message.Type, "this", "tag", abort)
nn, err = this.generateDecodeValue(message.Type, "this", "tag")
n += nn; if err != nil { return n, err }
nn, err = this.iprintf("return n, nil\n")
n += nn; if err != nil { return n, err }
@ -419,7 +415,7 @@ func (this *Generator) generateEncodeValue(typ Type, valueSource, tagSource stri
// - n int
// - err error
// - nn int
func (this *Generator) generateDecodeValue(typ Type, valueSource, tagSource, abort string) (n int, err error) {
func (this *Generator) generateDecodeValue(typ Type, valueSource, tagSource string) (n int, err error) {
switch typ := typ.(type) {
case TypeInt:
// SI: (none)