Skip to content

Commit

Permalink
Deleted pointless indexation of overloads.
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information
ddobrev committed Jul 15, 2017
1 parent 351bae6 commit 40e6abb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
7 changes: 0 additions & 7 deletions src/AST/Function.cs
Expand Up @@ -144,7 +144,6 @@ public Function()
Parameters = new List<Parameter>();
CallingConvention = CallingConvention.Default;
Signature = string.Empty;
Index = null;
}

public Function(Function function)
Expand All @@ -163,7 +162,6 @@ public Function(Function function)
SynthKind = function.SynthKind;
OriginalFunction = function.OriginalFunction;
Mangled = function.Mangled;
Index = function.Index;
Signature = function.Signature;
FunctionType = function.FunctionType;
if (function.SpecializationInfo != null)
Expand Down Expand Up @@ -249,11 +247,6 @@ public QualifiedType OriginalReturnType
/// </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);
Expand Down
12 changes: 2 additions & 10 deletions src/Generator/Generators/CSharp/CSharpSources.cs
Expand Up @@ -3049,18 +3049,10 @@ public static string GetFunctionIdentifier(Function function)
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();
Expand Down
9 changes: 0 additions & 9 deletions src/Generator/Passes/CheckDuplicatedNamesPass.cs
Expand Up @@ -179,15 +179,6 @@ public override bool VisitClassDecl(Class @class)
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;
}

Expand Down

0 comments on commit 40e6abb

Please sign in to comment.