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. 8
      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
Parameters = new List<Parameter>(); Parameters = new List<Parameter>();
CallingConvention = CallingConvention.Default; CallingConvention = CallingConvention.Default;
Signature = string.Empty; Signature = string.Empty;
Index = null;
} }
public Function(Function function) public Function(Function function)
@ -163,7 +162,6 @@ namespace CppSharp.AST
SynthKind = function.SynthKind; SynthKind = function.SynthKind;
OriginalFunction = function.OriginalFunction; OriginalFunction = function.OriginalFunction;
Mangled = function.Mangled; Mangled = function.Mangled;
Index = function.Index;
Signature = function.Signature; Signature = function.Signature;
FunctionType = function.FunctionType; FunctionType = function.FunctionType;
if (function.SpecializationInfo != null) if (function.SpecializationInfo != null)
@ -249,11 +247,6 @@ namespace CppSharp.AST
/// </summary> /// </summary>
public Field Field { get; set; } 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) public override T Visit<T>(IDeclVisitor<T> visitor)
{ {
return visitor.VisitFunctionDecl(this); return visitor.VisitFunctionDecl(this);

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

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

9
src/Generator/Passes/CheckDuplicatedNamesPass.cs

@ -179,15 +179,6 @@ namespace CppSharp.Passes
foreach (var property in @class.Properties) foreach (var property in @class.Properties)
VisitProperty(property); 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; return false;
} }

Loading…
Cancel
Save