Browse Source

Removed the fixing of names of constructors and destructors.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/913/head
Dimitar Dobrev 9 years ago
parent
commit
1c81a92061
  1. 9
      src/Generator.Tests/AST/TestAST.cs
  2. 6
      src/Generator/Passes/CleanInvalidDeclNamesPass.cs

9
src/Generator.Tests/AST/TestAST.cs

@ -553,5 +553,14 @@ namespace CppSharp.Generator.Tests.AST @@ -553,5 +553,14 @@ namespace CppSharp.Generator.Tests.AST
Assert.That($"{type}",
Is.EqualTo("global::Test.TestTemplateClass<T>.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<T>"));
}
}
}

6
src/Generator/Passes/CleanInvalidDeclNamesPass.cs

@ -47,8 +47,10 @@ namespace CppSharp.Passes @@ -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);

Loading…
Cancel
Save