Skip to content

Commit

Permalink
switch root element when inlining (#172)
Browse files Browse the repository at this point in the history
* switch root element when propogating inlines; add a test for recursive and mutually-recursive types
  • Loading branch information
philhofer authored Jan 1, 2017
1 parent 38a6f61 commit 362bfb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 10 additions & 0 deletions _generated/def.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,13 @@ type FileHandle struct {

type CustomInt int
type CustomBytes []byte

type Wrapper struct {
Tree *Tree
}

type Tree struct {
Children []Tree
Element int
Parent *Wrapper
}
4 changes: 1 addition & 3 deletions parse/inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,8 @@ func (f *FileSet) nextInline(ref *gen.Elem, root string) {
panic(fatalloop)
}

// inline bottom-up so as not to miss
// other inlining opportunities.
f.nextInline(&node, root)
*ref = node.Copy()
f.nextInline(ref, node.TypeName())
} else if !ok && !el.Resolved() {
// this is the point at which we're sure that
// we've got a type that isn't a primitive,
Expand Down

0 comments on commit 362bfb3

Please sign in to comment.