From 76cf4e68d80623d554ffa96299ec170877edc32e Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 18 Feb 2014 23:30:35 +0000 Subject: [PATCH] Simplify declaration ignores by removing IsProcessed and fixing ExplicitlyIgnored to be recursive like the others ignore properties. --- src/AST/Declaration.cs | 24 ++++--------------- src/AST/TranslationUnit.cs | 6 ----- .../Generators/CSharp/CSharpTextTemplate.cs | 2 +- src/Generator/Library.cs | 1 - src/Generator/Passes/Pass.cs | 3 --- src/Generator/Types/Types.cs | 2 +- 6 files changed, 7 insertions(+), 31 deletions(-) diff --git a/src/AST/Declaration.cs b/src/AST/Declaration.cs index 759afc39..f88cb2ea 100644 --- a/src/AST/Declaration.cs +++ b/src/AST/Declaration.cs @@ -133,32 +133,18 @@ namespace CppSharp.AST } } - // Whether the declaration should be processed. - public virtual bool IsProcessed + // Whether the declaration was explicitly ignored. + public bool ExplicityIgnored { get { - var isProcessed = !IgnoreFlags.HasFlag(IgnoreFlags.Processing); + var isExplicitlyIgnored = IgnoreFlags.HasFlag(IgnoreFlags.Explicit); if (Namespace == null) - return isProcessed; - - return isProcessed && Namespace.IsProcessed; - } + return isExplicitlyIgnored; - set - { - if (value) - IgnoreFlags &= ~IgnoreFlags.Processing; - else - IgnoreFlags |= IgnoreFlags.Processing; + return isExplicitlyIgnored || Namespace.ExplicityIgnored; } - } - - // Whether the declaration was explicitly ignored. - public bool ExplicityIgnored - { - get { return IgnoreFlags.HasFlag(IgnoreFlags.Explicit); } set { diff --git a/src/AST/TranslationUnit.cs b/src/AST/TranslationUnit.cs index d2ab8e6d..11f59808 100644 --- a/src/AST/TranslationUnit.cs +++ b/src/AST/TranslationUnit.cs @@ -30,12 +30,6 @@ namespace CppSharp.AST 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. public override bool Ignore { diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 81c766d9..faee2b74 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -2459,7 +2459,7 @@ namespace CppSharp.Generators.CSharp public void GenerateInternalFunction(Function function) { - if (!function.IsProcessed || function.ExplicityIgnored || function.IsPure) + if (function.ExplicityIgnored || function.IsPure) return; if (function.OriginalFunction != null) diff --git a/src/Generator/Library.cs b/src/Generator/Library.cs index 9177ae08..7bd6966c 100644 --- a/src/Generator/Library.cs +++ b/src/Generator/Library.cs @@ -318,7 +318,6 @@ namespace CppSharp foreach (var unit in units) { unit.IsGenerated = false; - unit.IsProcessed = true; unit.ExplicityIgnored = true; } } diff --git a/src/Generator/Passes/Pass.cs b/src/Generator/Passes/Pass.cs index 4d8007dc..d9bb6efe 100644 --- a/src/Generator/Passes/Pass.cs +++ b/src/Generator/Passes/Pass.cs @@ -30,9 +30,6 @@ namespace CppSharp.Passes public virtual bool VisitTranslationUnit(TranslationUnit unit) { - if (!unit.IsProcessed) - return false; - if (unit.IsSystemHeader) return false; diff --git a/src/Generator/Types/Types.cs b/src/Generator/Types/Types.cs index 24a0733d..871ee015 100644 --- a/src/Generator/Types/Types.cs +++ b/src/Generator/Types/Types.cs @@ -54,7 +54,7 @@ namespace CppSharp if (decl.CompleteDeclaration != null) return VisitDeclaration(decl.CompleteDeclaration); - if (!decl.IsProcessed || decl.ExplicityIgnored) + if (decl.ExplicityIgnored) { Ignore(); return false;