Deduplicate function names

This commit is contained in:
Garry Newman 2019-04-16 16:50:05 +01:00
parent 5782160623
commit b6f651b45c
2 changed files with 25 additions and 1 deletions

View File

@ -46,6 +46,29 @@ internal Function AddFunction( string funcName, string returnType, string args )
return f;
}
public void PostProcess()
{
var LastName = "";
var DuplicateCount = 0;
for (int i=0; i< Functions.Count; i++ )
{
var ThisName = Functions[i].Name;
if ( Functions[i].Name == LastName)
{
DuplicateCount++;
Functions[i].Name += $"{DuplicateCount + 1}";
}
else
{
DuplicateCount = 0;
}
LastName = ThisName;
}
}
}
}

View File

@ -54,7 +54,7 @@ public void ProcessClass( string fulldef, string classname, string inner )
if ( line.Trim().StartsWith( "public:" ) ) continue;
if ( line.Trim().StartsWith( "//" ) ) continue;
var callresult = Regex.Match( line, @"STEAM_CALL_RESULT\( (.+?) \)" );
var callresult = Regex.Match( line, @"STEAM_CALL_RESULT\((.+?)\)" );
if ( callresult.Success )
{
lastCallResult = callresult.Groups[1].Value.Trim();
@ -89,6 +89,7 @@ public void ProcessClass( string fulldef, string classname, string inner )
}
}
c.PostProcess();
Classes.Add( c );
}