generate: Fix bad variable names

This commit is contained in:
Sasha Koshka 2025-08-06 18:48:17 -04:00
parent 77c6b67d65
commit 170f79c914

View File

@ -593,7 +593,7 @@ func (this *Generator) generateDecodeBranch(hash [16]byte, typ Type) (n int, err
n += nn; if err != nil { return n, err }
nn, err = this.generateType(typ)
n += nn; if err != nil { return n, err }
nn, err = this.printf("](this *T, decoder *tape.Decoder, tag tape.Tag) (nn int, err error) {\n")
nn, err = this.printf("](this *T, decoder *tape.Decoder, tag tape.Tag) (n int, err error) {\n")
n += nn; if err != nil { return n, err }
this.push()
@ -691,7 +691,7 @@ func (this *Generator) generateDecodeBranch(hash [16]byte, typ Type) (n int, err
// problems
// read fields
nn, err = this.iprintf("for index = range %s {\n", lengthVar)
nn, err = this.iprintf("for %s = range %s {\n", indexVar, lengthVar)
n += nn; if err != nil { return n, err }
this.push()
// read field header
@ -720,11 +720,11 @@ func (this *Generator) generateDecodeBranch(hash [16]byte, typ Type) (n int, err
}
// switch on tag
nn, err = this.iprintf("switch %s {\n", fieldTagVar)
nn, err = this.iprintf("switch %s {\n", fieldKeyVar)
n += nn; if err != nil { return n, err }
for _, key := range slices.Sorted(maps.Keys(typ.Fields)) {
field := typ.Fields[key]
nn, err = this.iprintf("case %s:\n", fieldTagVar)
nn, err = this.iprintf("case 0x%04X:\n", key)
n += nn; if err != nil { return n, err }
this.push()