Skip to content

Commit b47fb02

Browse files
committed
Fix stack overflow with circular types
Fixes #19
1 parent 38229b0 commit b47fb02

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

s2ts.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,12 @@ func (s *StructToTS) addType(t reflect.Type, name string) (out *Struct) {
148148
out = &Struct{
149149
Name: name,
150150
Fields: make([]*Field, 0, t.NumField()),
151-
152-
t: t,
151+
t: t,
153152
}
154153

154+
s.seen[t] = out
155155
// log.Println("building struct:", out.Name)
156156
s.addTypeFields(out, t)
157-
s.seen[t] = out
158157
s.structs = append(s.structs, out)
159158
// log.Println("/building struct:", out.Name)
160159
return

0 commit comments

Comments
 (0)