generate: Fix spacing and comment issues

This commit is contained in:
Sasha Koshka 2025-10-16 21:59:53 -04:00
parent e6266e500c
commit 207627c428

View File

@ -20,7 +20,6 @@ const preamble = `
// The source file is located at <path> // The source file is located at <path>
// Please edit that file instead, and re-compile it to this location. // Please edit that file instead, and re-compile it to this location.
// HOPP, TAPE, METADAPT, PDL/0 (c) 2025 holanet.xyz // HOPP, TAPE, METADAPT, PDL/0 (c) 2025 holanet.xyz
` `
const static = ` const static = `
@ -58,6 +57,7 @@ func boolInt(input bool) int {
} }
} }
// ensure ucontainer is always imported
var _ hopp.Option[int] var _ hopp.Option[int]
` `
@ -184,7 +184,7 @@ func (this *Generator) generateTypedef(name string, typedef Typedef) (n int, err
// DecodeValue method // DecodeValue method
nn, err = this.iprintf( nn, err = this.iprintf(
"\n // DecodeValue decodes the value of this type without " + "\n// DecodeValue decodes the value of this type without " +
"the tag. The value is\n// decoded according to the " + "the tag. The value is\n// decoded according to the " +
"parameters specified by the tag, if possible.\n") "parameters specified by the tag, if possible.\n")
n += nn; if err != nil { return n, err } n += nn; if err != nil { return n, err }
@ -1140,8 +1140,10 @@ func (this *Generator) generateTypeTableDefined(typ TypeTableDefined) (n int, er
for _, key := range slices.Sorted(maps.Keys(typ.Fields)) { for _, key := range slices.Sorted(maps.Keys(typ.Fields)) {
field := typ.Fields[key] field := typ.Fields[key]
nn, err := this.iprintf("%s\n", this.formatComment(field.Doc)) if field.Doc != "" {
n += nn; if err != nil { return n, err } nn, err := this.iprintf("%s\n", this.formatComment(field.Doc))
n += nn; if err != nil { return n, err }
}
nn, err = this.iprintf("%s ", field.Name) nn, err = this.iprintf("%s ", field.Name)
n += nn; if err != nil { return n, err } n += nn; if err != nil { return n, err }
if field.Option { if field.Option {