Skip to content

Commit

Permalink
Fix struct size fetching bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xxuejie committed May 6, 2020
1 parent 40226bf commit 2158f10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ function serializeTable(buffers) {
sizes = append(sizes, fmt.Sprintf("%s.size()", field.Type))
}
}
fmt.Fprintln(writer, ` validate(compatible = false) {
assertDataLength(this.view.byteLength, this.size());`)
fmt.Fprintf(writer, ` validate(compatible = false) {
assertDataLength(this.view.byteLength, %s.size());`+"\n", declaration.Name)
for _, field := range declaration.Fields {
if field.Type != "byte" {
fmt.Fprintf(writer, " this.%s().validate(compatible);\n",
Expand Down

0 comments on commit 2158f10

Please sign in to comment.