Browse Source

Fixed parsing and marshaling of dependent declarations.

pull/125/head
triton 12 years ago
parent
commit
c8b0f515b3
  1. 4
      src/Generator/Generators/CLI/CLIMarshal.cs
  2. 10
      src/Generator/Generators/CSharp/CSharpMarshal.cs
  3. 10
      src/Parser/Parser.cpp

4
src/Generator/Generators/CLI/CLIMarshal.cs

@ -282,7 +282,7 @@ namespace CppSharp.Generators.CLI @@ -282,7 +282,7 @@ namespace CppSharp.Generators.CLI
public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
{
throw new NotImplementedException();
return template.TemplatedFunction.Visit(this);
}
public override bool VisitMacroDefinition(MacroDefinition macro)
@ -666,7 +666,7 @@ namespace CppSharp.Generators.CLI @@ -666,7 +666,7 @@ namespace CppSharp.Generators.CLI
public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
{
throw new NotImplementedException();
return template.TemplatedFunction.Visit(this);
}
public override bool VisitMacroDefinition(MacroDefinition macro)

10
src/Generator/Generators/CSharp/CSharpMarshal.cs

@ -616,6 +616,16 @@ namespace CppSharp.Generators.CSharp @@ -616,6 +616,16 @@ namespace CppSharp.Generators.CSharp
Context.Return.Write(Context.Parameter.Name);
return true;
}
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
return VisitClassDecl(template.TemplatedClass);
}
public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
{
return template.TemplatedFunction.Visit(this);
}
}
public static class CSharpMarshalExtensions

10
src/Parser/Parser.cpp

@ -769,9 +769,6 @@ CppSharp::AST::ClassTemplate^ Parser::WalkClassTemplate(clang::ClassTemplateDecl @@ -769,9 +769,6 @@ CppSharp::AST::ClassTemplate^ Parser::WalkClassTemplate(clang::ClassTemplateDecl
using namespace clang;
using namespace clix;
if (TD->getCanonicalDecl() != TD)
return WalkClassTemplate(TD->getCanonicalDecl());
auto NS = GetNamespace(TD);
assert(NS && "Expected a valid namespace");
@ -808,9 +805,6 @@ CppSharp::AST::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTem @@ -808,9 +805,6 @@ CppSharp::AST::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTem
using namespace clang;
using namespace clix;
if (TD->getCanonicalDecl() != TD)
return WalkFunctionTemplate(TD->getCanonicalDecl());
auto NS = GetNamespace(TD);
assert(NS && "Expected a valid namespace");
@ -897,7 +891,9 @@ CppSharp::AST::Method^ Parser::WalkMethodCXX(clang::CXXMethodDecl* MD) @@ -897,7 +891,9 @@ CppSharp::AST::Method^ Parser::WalkMethodCXX(clang::CXXMethodDecl* MD)
return WalkMethodCXX(cast<CXXMethodDecl>(MD->getPrimaryContext()));
auto RD = MD->getParent();
auto Class = WalkRecordCXX(RD);
auto Decl = WalkDeclaration(RD, /*IgnoreSystemDecls=*/false);
auto Class = safe_cast<CppSharp::AST::Class^>(Decl);
// Check for an already existing method that came from the same declaration.
for each (CppSharp::AST::Method^ Method in Class->Methods)

Loading…
Cancel
Save