From e3dd678d335f2c2b299b9c0531d4321c70f889ee Mon Sep 17 00:00:00 2001 From: triton Date: Mon, 11 Mar 2013 03:04:19 +0000 Subject: [PATCH] Fixed the rename passes to check if the declaration is re-nameable. --- src/Generator/Passes/RenamePass.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Generator/Passes/RenamePass.cs b/src/Generator/Passes/RenamePass.cs index c9e8d928..58d1c667 100644 --- a/src/Generator/Passes/RenamePass.cs +++ b/src/Generator/Passes/RenamePass.cs @@ -22,9 +22,28 @@ namespace Cxxi.Passes public abstract bool Rename(string name, out string newName); + public bool IsRenameableDecl(Declaration decl) + { + if (decl is Class) return true; + if (decl is Field) return true; + if (decl is Method) return true; + if (decl is Function) return true; + if (decl is Parameter) return true; + if (decl is Enumeration) return true; + return false; + } + public override bool VisitDeclaration(Declaration decl) { - if (!Targets.HasFlag(RenameTargets.Any)) + if (!IsRenameableDecl(decl)) + return true; + + if (AlreadyVisited(decl)) + return true; + + Visited.Add(decl); + + if (decl.Name == null) return true; string newName;