Skip to content
This repository was archived by the owner on Aug 27, 2018. It is now read-only.

Commit 8c68b88

Browse files
committed
bug fix
1 parent f8503b1 commit 8c68b88

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd/stateGen/gen.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ func (g *gen) genLeaf(n leafField) {
425425
426426
var _ Node = new({{.LeafType}})
427427
428-
func new{{.LeafType}}(r *rootNode, prefix string) *{{.LeafType}} {
429-
prefix = path.Join(prefix, "{{.LeafType}}")
428+
func new{{.LeafType}}(r *rootNode, prefix, fieldName string) *{{.LeafType}} {
429+
prefix = path.Join(prefix, "{{.LeafType}}", fieldName)
430430
431431
return &{{.LeafType}}{
432432
rootNode: r,
@@ -499,12 +499,12 @@ func (g *gen) genNode(n node) {
499499

500500
for _, c := range n.children {
501501
g.pt(`
502-
res._{{.Name}} = new{{.Type}}(r, prefix)
502+
res._{{.Name}} = new{{.Type}}(r, prefix, "{{.Name}}")
503503
`, c)
504504
}
505505
for _, l := range n.leaves {
506506
g.pt(`
507-
res._{{.Name}} = new{{.LeafType}}(r, prefix)
507+
res._{{.Name}} = new{{.LeafType}}(r, prefix, "{{.Name}}")
508508
`, l)
509509
}
510510

0 commit comments

Comments
 (0)