|
|
|
@ -343,7 +343,14 @@ func (this *Generator) generateEncodeValue(typ Type, valueSource, tagSource stri
|
|
|
|
case TypeBuffer:
|
|
|
|
case TypeBuffer:
|
|
|
|
// SBA: <data: U8>*
|
|
|
|
// SBA: <data: U8>*
|
|
|
|
// LBA: <length: UN> <data: U8>*
|
|
|
|
// LBA: <length: UN> <data: U8>*
|
|
|
|
nn, err := this.iprintf("if %s.Is(tape.LBA) {\n", tagSource)
|
|
|
|
nn, err := this.iprintf("if len(%s) > tape.MaxStructureLength {\n", valueSource)
|
|
|
|
|
|
|
|
n += nn; if err != nil { return n, err }
|
|
|
|
|
|
|
|
this.push()
|
|
|
|
|
|
|
|
nn, err = this.iprintf("return n, tape.ErrTooLong\n")
|
|
|
|
|
|
|
|
this.pop()
|
|
|
|
|
|
|
|
nn, err = this.iprintf("}\n")
|
|
|
|
|
|
|
|
n += nn; if err != nil { return n, err }
|
|
|
|
|
|
|
|
nn, err = this.iprintf("if %s.Is(tape.LBA) {\n", tagSource)
|
|
|
|
n += nn; if err != nil { return n, err }
|
|
|
|
n += nn; if err != nil { return n, err }
|
|
|
|
this.push()
|
|
|
|
this.push()
|
|
|
|
nn, err = this.iprintf(
|
|
|
|
nn, err = this.iprintf(
|
|
|