From 1c81a92061488347be398d8c95d311e7fcc9d052 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Sun, 13 Aug 2017 01:06:49 +0300 Subject: [PATCH] Removed the fixing of names of constructors and destructors. Signed-off-by: Dimitar Dobrev --- src/Generator.Tests/AST/TestAST.cs | 9 +++++++++ src/Generator/Passes/CleanInvalidDeclNamesPass.cs | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Generator.Tests/AST/TestAST.cs b/src/Generator.Tests/AST/TestAST.cs index 6c65c798..7af4563d 100644 --- a/src/Generator.Tests/AST/TestAST.cs +++ b/src/Generator.Tests/AST/TestAST.cs @@ -553,5 +553,14 @@ namespace CppSharp.Generator.Tests.AST Assert.That($"{type}", Is.EqualTo("global::Test.TestTemplateClass.NestedInTemplate")); } + + [Test] + public void TestTemplateConstructorName() + { + new CleanInvalidDeclNamesPass { Context = Driver.Context }.VisitASTContext(AstContext); + var template = AstContext.FindClass("TestTemplateClass").First(); + foreach (var constructor in template.Constructors) + Assert.That(constructor.Name, Is.EqualTo("TestTemplateClass")); + } } } diff --git a/src/Generator/Passes/CleanInvalidDeclNamesPass.cs b/src/Generator/Passes/CleanInvalidDeclNamesPass.cs index ad85429b..3ec63d32 100644 --- a/src/Generator/Passes/CleanInvalidDeclNamesPass.cs +++ b/src/Generator/Passes/CleanInvalidDeclNamesPass.cs @@ -47,8 +47,10 @@ namespace CppSharp.Passes return true; } - Function function = decl as Function; - if ((function == null || !function.IsOperator) && !(decl is Enumeration)) + var function = decl as Function; + var method = function as Method; + if ((function == null || !function.IsOperator) && !(decl is Enumeration) && + (method == null || method.Kind == CXXMethodKind.Normal)) decl.Name = CheckName(decl.Name); StringHelpers.CleanupText(ref decl.DebugText);