fix: avoid infinite loop when parsing recursive types
Mark all visited types as such when walking down struct fields. Fixes #750. Updates #652.
This commit is contained in:
@@ -1385,6 +1385,8 @@ func hasRecursiveStruct(t *itype, defined map[string]*itype) bool {
|
||||
if defined[typ.path+"/"+typ.name] != nil {
|
||||
return true
|
||||
}
|
||||
defined[typ.path+"/"+typ.name] = typ
|
||||
|
||||
for _, f := range typ.field {
|
||||
if hasRecursiveStruct(f.typ, defined) {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user