Browse Source

Deleted pointless indexation of overloads.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/888/head
Dimitar Dobrev 8 years ago
parent
commit
40e6abbd22
  1. 7
      src/AST/Function.cs
  2. 12
      src/Generator/Generators/CSharp/CSharpSources.cs
  3. 9
      src/Generator/Passes/CheckDuplicatedNamesPass.cs

7
src/AST/Function.cs

@ -144,7 +144,6 @@ namespace CppSharp.AST @@ -144,7 +144,6 @@ namespace CppSharp.AST
Parameters = new List<Parameter>();
CallingConvention = CallingConvention.Default;
Signature = string.Empty;
Index = null;
}
public Function(Function function)
@ -163,7 +162,6 @@ namespace CppSharp.AST @@ -163,7 +162,6 @@ namespace CppSharp.AST
SynthKind = function.SynthKind;
OriginalFunction = function.OriginalFunction;
Mangled = function.Mangled;
Index = function.Index;
Signature = function.Signature;
FunctionType = function.FunctionType;
if (function.SpecializationInfo != null)
@ -249,11 +247,6 @@ namespace CppSharp.AST @@ -249,11 +247,6 @@ namespace CppSharp.AST
/// </summary>
public Field Field { get; set; }
/// <summary>
/// Keeps an index that de-duplicates native names in the C# backend.
/// </summary>
public uint? Index { get; set; }
public override T Visit<T>(IDeclVisitor<T> visitor)
{
return visitor.VisitFunctionDecl(this);

12
src/Generator/Generators/CSharp/CSharpSources.cs

@ -3049,18 +3049,10 @@ namespace CppSharp.Generators.CSharp @@ -3049,18 +3049,10 @@ namespace CppSharp.Generators.CSharp
if (overloads.Count > 1)
index = overloads.IndexOf(function);
if (index >= 0)
{
if (index > 0)
{
identifier.Append('_');
identifier.Append(index.ToString(CultureInfo.InvariantCulture));
}
}
else if (function.Index.HasValue)
if (index > 0)
{
identifier.Append('_');
identifier.Append(function.Index.Value);
identifier.Append(index.ToString(CultureInfo.InvariantCulture));
}
return identifier.ToString();

9
src/Generator/Passes/CheckDuplicatedNamesPass.cs

@ -179,15 +179,6 @@ namespace CppSharp.Passes @@ -179,15 +179,6 @@ namespace CppSharp.Passes
foreach (var property in @class.Properties)
VisitProperty(property);
var total = (uint)0;
foreach (var method in @class.Methods.Where(m => m.IsConstructor &&
!m.IsCopyConstructor && !m.IsMoveConstructor))
method.Index = total++;
total = 0;
foreach (var method in @class.Methods.Where(m => m.IsCopyConstructor))
method.Index = total++;
return false;
}

Loading…
Cancel
Save