Browse Source

Improve CS_INTERNAL so it now applies to all declarations.

Signed-off-by: Joao Matos <joao@tritao.eu>
pull/1276/head
Joao Matos 7 years ago
parent
commit
899e8d2caa
  1. 9
      src/Generator/Passes/CheckMacrosPass.cs

9
src/Generator/Passes/CheckMacrosPass.cs

@ -42,7 +42,7 @@ namespace CppSharp.Passes
/// CS_CONSTRAINT(TYPE [, TYPE]*) (templates) /// CS_CONSTRAINT(TYPE [, TYPE]*) (templates)
/// Used to define constraint of generated generic type or generic method. /// Used to define constraint of generated generic type or generic method.
/// ///
/// CS_INTERNAL (methods) /// CS_INTERNAL (declarations)
/// Used to flag a method as internal to an assembly. So, it is /// Used to flag a method as internal to an assembly. So, it is
/// not accessible outside that assembly. /// not accessible outside that assembly.
/// ///
@ -60,7 +60,6 @@ namespace CppSharp.Passes
public override bool VisitDeclaration(Declaration decl) public override bool VisitDeclaration(Declaration decl)
{ {
if (AlreadyVisited(decl)) if (AlreadyVisited(decl))
return false; return false;
@ -69,6 +68,9 @@ namespace CppSharp.Passes
var expansions = decl.PreprocessedEntities.OfType<MacroExpansion>(); var expansions = decl.PreprocessedEntities.OfType<MacroExpansion>();
if (expansions.Any(e => e.Text == Prefix + "_INTERNAL"))
decl.Access = AccessSpecifier.Internal;
CheckIgnoreMacros(decl, expansions); CheckIgnoreMacros(decl, expansions);
return true; return true;
} }
@ -160,9 +162,6 @@ namespace CppSharp.Passes
|| e.Text == Prefix + "_EQUALS")) || e.Text == Prefix + "_EQUALS"))
method.ExplicitlyIgnore(); method.ExplicitlyIgnore();
if (expansions.Any(e => e.Text == Prefix + "_INTERNAL"))
method.Access = AccessSpecifier.Internal;
return base.VisitMethodDecl(method); return base.VisitMethodDecl(method);
} }

Loading…
Cancel
Save