Skip to content

Commit

Permalink
Fix slice bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xxuejie committed Mar 30, 2020
1 parent 845fb41 commit 40226bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,12 @@ function serializeTable(buffers) {
sizes = append(sizes, "1")
} else {
fmt.Fprintf(writer, ` %s() {
return new %s(this.view.buffer.slice(%s, %s.size()), { validate: false });
return new %s(this.view.buffer.slice(%s, %s + %s.size()), { validate: false });
}`+"\n\n",
strcase.ToLowerCamel(fmt.Sprintf("get_%s", field.Name)),
field.Type,
strings.Join(sizes, " + "),
strings.Join(sizes, " + "),
field.Type)
sizes = append(sizes, fmt.Sprintf("%s.size()", field.Type))
}
Expand Down

0 comments on commit 40226bf

Please sign in to comment.