Browse Source

Corrected the checks for private methods because overrides must be allowed through regardless of access.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/57/head
Dimitar Dobrev 13 years ago
parent
commit
de8b3fc00e
  1. 2
      src/Generator/AST/Utils.cs
  2. 5
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  3. 2
      src/Generator/Passes/CheckIgnoredDecls.cs
  4. 12
      src/Generator/Passes/GenerateInlinesCodePass.cs

2
src/Generator/AST/Utils.cs

@ -37,7 +37,7 @@ namespace CppSharp.AST
if (method.Kind == CXXMethodKind.Conversion) if (method.Kind == CXXMethodKind.Conversion)
return true; return true;
if (method.Access == AccessSpecifier.Private) if (method.Access == AccessSpecifier.Private && !method.IsOverride)
return true; return true;
return false; return false;

5
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -1585,11 +1585,10 @@ namespace CppSharp.Generators.CSharp
case AccessSpecifier.Public: case AccessSpecifier.Public:
return @class.IsAbstract && method.IsConstructor ? return @class.IsAbstract && method.IsConstructor ?
AccessSpecifier.Protected : AccessSpecifier.Public; AccessSpecifier.Protected : AccessSpecifier.Public;
case AccessSpecifier.Protected: default:
return method.IsOverride ? return method.IsOverride ?
@class.GetRootBaseMethod(method).Access : AccessSpecifier.Protected; @class.GetRootBaseMethod(method).Access : method.Access;
} }
return AccessSpecifier.Private;
} }
private void GenerateVirtualTableFunctionCall(Function method, Class @class) private void GenerateVirtualTableFunctionCall(Function method, Class @class)

2
src/Generator/Passes/CheckIgnoredDecls.cs

@ -109,7 +109,7 @@ namespace CppSharp.Passes
if (!VisitDeclaration(method)) if (!VisitDeclaration(method))
return false; return false;
if (method.Access == AccessSpecifier.Private) if (method.Access == AccessSpecifier.Private && !method.IsOverride)
{ {
method.ExplicityIgnored = true; method.ExplicityIgnored = true;
return false; return false;

12
src/Generator/Passes/GenerateInlinesCodePass.cs

@ -65,7 +65,7 @@ namespace CppSharp.Passes
{ {
string symbol = mangled.Mangled; string symbol = mangled.Mangled;
var declaration = (Declaration) mangled; var declaration = (Declaration) mangled;
if (!declaration.Ignore && declaration.Access != AccessSpecifier.Private && if (!declaration.Ignore && AccessValid(declaration) &&
!Driver.LibrarySymbols.FindSymbol(ref symbol) && !Driver.LibrarySymbols.FindSymbol(ref symbol) &&
!currentUnit.FilePath.EndsWith("_impl.h") && !currentUnit.FilePath.EndsWith("_impl.h") &&
!currentUnit.FilePath.EndsWith("_p.h")) !currentUnit.FilePath.EndsWith("_p.h"))
@ -76,5 +76,15 @@ namespace CppSharp.Passes
mangledInlines.Add(mangled.Mangled); mangledInlines.Add(mangled.Mangled);
} }
} }
private static bool AccessValid(Declaration declaration)
{
if (declaration.Access == AccessSpecifier.Private)
{
var method = declaration as Method;
return method != null && method.IsOverride;
}
return true;
}
} }
} }

Loading…
Cancel
Save