Browse Source

Simplify declaration ignores by removing IsProcessed and fixing ExplicitlyIgnored to be recursive like the others ignore properties.

pull/169/head
triton 12 years ago
parent
commit
76cf4e68d8
  1. 24
      src/AST/Declaration.cs
  2. 6
      src/AST/TranslationUnit.cs
  3. 2
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  4. 1
      src/Generator/Library.cs
  5. 3
      src/Generator/Passes/Pass.cs
  6. 2
      src/Generator/Types/Types.cs

24
src/AST/Declaration.cs

@ -133,32 +133,18 @@ namespace CppSharp.AST
} }
} }
// Whether the declaration should be processed. // Whether the declaration was explicitly ignored.
public virtual bool IsProcessed public bool ExplicityIgnored
{ {
get get
{ {
var isProcessed = !IgnoreFlags.HasFlag(IgnoreFlags.Processing); var isExplicitlyIgnored = IgnoreFlags.HasFlag(IgnoreFlags.Explicit);
if (Namespace == null) if (Namespace == null)
return isProcessed; return isExplicitlyIgnored;
return isProcessed && Namespace.IsProcessed;
}
set return isExplicitlyIgnored || Namespace.ExplicityIgnored;
{
if (value)
IgnoreFlags &= ~IgnoreFlags.Processing;
else
IgnoreFlags |= IgnoreFlags.Processing;
} }
}
// Whether the declaration was explicitly ignored.
public bool ExplicityIgnored
{
get { return IgnoreFlags.HasFlag(IgnoreFlags.Explicit); }
set set
{ {

6
src/AST/TranslationUnit.cs

@ -30,12 +30,6 @@ namespace CppSharp.AST
get { return !IgnoreFlags.HasFlag(IgnoreFlags.Generation); } get { return !IgnoreFlags.HasFlag(IgnoreFlags.Generation); }
} }
// Whether the unit should be processed.
public override bool IsProcessed
{
get { return !IgnoreFlags.HasFlag(IgnoreFlags.Processing); }
}
// Whether the unit should be ignored. // Whether the unit should be ignored.
public override bool Ignore public override bool Ignore
{ {

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

@ -2459,7 +2459,7 @@ namespace CppSharp.Generators.CSharp
public void GenerateInternalFunction(Function function) public void GenerateInternalFunction(Function function)
{ {
if (!function.IsProcessed || function.ExplicityIgnored || function.IsPure) if (function.ExplicityIgnored || function.IsPure)
return; return;
if (function.OriginalFunction != null) if (function.OriginalFunction != null)

1
src/Generator/Library.cs

@ -318,7 +318,6 @@ namespace CppSharp
foreach (var unit in units) foreach (var unit in units)
{ {
unit.IsGenerated = false; unit.IsGenerated = false;
unit.IsProcessed = true;
unit.ExplicityIgnored = true; unit.ExplicityIgnored = true;
} }
} }

3
src/Generator/Passes/Pass.cs

@ -30,9 +30,6 @@ namespace CppSharp.Passes
public virtual bool VisitTranslationUnit(TranslationUnit unit) public virtual bool VisitTranslationUnit(TranslationUnit unit)
{ {
if (!unit.IsProcessed)
return false;
if (unit.IsSystemHeader) if (unit.IsSystemHeader)
return false; return false;

2
src/Generator/Types/Types.cs

@ -54,7 +54,7 @@ namespace CppSharp
if (decl.CompleteDeclaration != null) if (decl.CompleteDeclaration != null)
return VisitDeclaration(decl.CompleteDeclaration); return VisitDeclaration(decl.CompleteDeclaration);
if (!decl.IsProcessed || decl.ExplicityIgnored) if (decl.ExplicityIgnored)
{ {
Ignore(); Ignore();
return false; return false;

Loading…
Cancel
Save