diff --git a/src/Generator/AST/ASTRecord.cs b/src/Generator/AST/ASTRecord.cs index 30be7e01..4e3b816f 100644 --- a/src/Generator/AST/ASTRecord.cs +++ b/src/Generator/AST/ASTRecord.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CppSharp.AST; using Type = CppSharp.AST.Type; @@ -104,6 +105,11 @@ namespace CppSharp.Generators.AST return recordStack.Any(rec => decl == rec.Object); } + public bool Contains(Func func) + { + return recordStack.Any(func); + } + public bool IsBeingVisited(Declaration decl) { var record = recordStack.FirstOrDefault(rec => decl == rec.Object); @@ -195,6 +201,9 @@ namespace CppSharp.Generators.AST if (decl is TranslationUnit) return false; + if (recordStack.Contains(record => record.Object is Type)) + return false; + if (recordStack.IsBeingVisited(decl)) return false;