Browse Source

Fixed the check for ignoring to verify the access at the declaration level.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/57/head
Dimitar Dobrev 12 years ago
parent
commit
a15c5b8f99
  1. 1
      src/AST/TranslationUnit.cs
  2. 35
      src/Generator/Passes/CheckIgnoredDecls.cs

1
src/AST/TranslationUnit.cs

@ -14,6 +14,7 @@ namespace CppSharp.AST @@ -14,6 +14,7 @@ namespace CppSharp.AST
{
Macros = new List<MacroDefinition>();
FilePath = file;
Access = AccessSpecifier.Public;
}
/// Contains the macros present in the unit.

35
src/Generator/Passes/CheckIgnoredDecls.cs

@ -5,15 +5,21 @@ namespace CppSharp.Passes @@ -5,15 +5,21 @@ namespace CppSharp.Passes
{
public class CheckIgnoredDeclsPass : TranslationUnitPass
{
public CheckIgnoredDeclsPass()
{
}
public override bool VisitDeclaration(Declaration decl)
{
if (decl.ExplicityIgnored)
return false;
if (decl.Access == AccessSpecifier.Private)
{
Method method = decl as Method;
if (method == null || !method.IsOverride)
{
decl.ExplicityIgnored = true;
return false;
}
}
if (decl.IsDependent)
{
decl.ExplicityIgnored = true;
@ -24,16 +30,6 @@ namespace CppSharp.Passes @@ -24,16 +30,6 @@ namespace CppSharp.Passes
return true;
}
public override bool VisitClassDecl(Class @class)
{
if (@class.Access == AccessSpecifier.Private)
{
@class.ExplicityIgnored = true;
return false;
}
return base.VisitClassDecl(@class);
}
public override bool VisitFieldDecl(Field field)
{
if (!VisitDeclaration(field))
@ -106,16 +102,7 @@ namespace CppSharp.Passes @@ -106,16 +102,7 @@ namespace CppSharp.Passes
public override bool VisitMethodDecl(Method method)
{
if (!VisitDeclaration(method))
return false;
if (method.Access == AccessSpecifier.Private && !method.IsOverride)
{
method.ExplicityIgnored = true;
return false;
}
return base.VisitMethodDecl(method);
return VisitDeclaration(method) && base.VisitMethodDecl(method);
}
public override bool VisitTypedefDecl(TypedefDecl typedef)

Loading…
Cancel
Save