Browse Source

Fixed an exhausted stack when parsing deep headers.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/696/head
Dimitar Dobrev 9 years ago
parent
commit
8d765cec6b
  1. 11
      src/Parser/ASTConverter.cs

11
src/Parser/ASTConverter.cs

@ -916,10 +916,13 @@ namespace CppSharp
public void VisitDeclContext(DeclarationContext ctx, AST.DeclarationContext _ctx) public void VisitDeclContext(DeclarationContext ctx, AST.DeclarationContext _ctx)
{ {
var namespaces = new Dictionary<Namespace, AST.Namespace>();
for (uint i = 0; i < ctx.NamespacesCount; ++i) for (uint i = 0; i < ctx.NamespacesCount; ++i)
{ {
var decl = ctx.getNamespaces(i); var decl = ctx.getNamespaces(i);
var _decl = Visit(decl) as AST.Namespace; var _decl = Visit(decl) as AST.Namespace;
namespaces.Add(decl, _decl);
_ctx.Namespaces.Add(_decl); _ctx.Namespaces.Add(_decl);
} }
@ -973,6 +976,13 @@ namespace CppSharp
_ctx.Declarations.Add(_decl); _ctx.Declarations.Add(_decl);
} }
foreach (var @namespace in namespaces)
{
VisitDeclContext(@namespace.Key, @namespace.Value);
}
namespaces.Clear();
// Anonymous types // Anonymous types
} }
@ -997,7 +1007,6 @@ namespace CppSharp
{ {
var _namespace = new AST.Namespace(); var _namespace = new AST.Namespace();
VisitDeclaration(decl, _namespace); VisitDeclaration(decl, _namespace);
VisitDeclContext(decl, _namespace);
_namespace.IsInline = decl.IsInline; _namespace.IsInline = decl.IsInline;
return _namespace; return _namespace;

Loading…
Cancel
Save