Skip to content
Permalink
Browse files

undo customize smybolnames

  • Loading branch information...
arakis committed Sep 8, 2019
1 parent 0e61982 commit e7d695bfc5d1350a759ea032b4159995fb1cba6c
@@ -4,22 +4,12 @@

namespace Mosa.Compiler.MosaTypeSystem
{
public class SignatureName
internal class SignatureName
{

// For better GDB, ELF, DWARF and exported EntryPoints, we want customize the SymbolName for better usability.
public delegate string GetSignatureDelegate(string name, MosaMethodSignature sig, bool shortSig, bool includeReturnType = true);
public static GetSignatureDelegate GetSignatureOverride;

public static string GetSignature(string name, MosaMethodSignature sig, bool shortSig, bool includeReturnType = true)
// For better GDB, ELF, DWARF and exported EntryPoints, we want avoid ReturnType and (Arguments) spaces within SymbolName for better usability.
public static string GetSignature(string name, MosaMethodSignature sig, bool shortSig, bool includeReturnType = true, bool stripSpaces = false)
{
if (GetSignatureOverride != null)
{
var signature = GetSignatureOverride(name, sig, shortSig, includeReturnType);
if (!string.IsNullOrEmpty(signature))
return signature;
}

var result = new StringBuilder();
if (shortSig)
{
@@ -28,7 +18,11 @@ public static string GetSignature(string name, MosaMethodSignature sig, bool sho
for (int i = 0; i < sig.Parameters.Count; i++)
{
if (i != 0)
result.Append(", ");
{
result.Append(",");
if (!stripSpaces)
result.Append(" ");
}
result.Append(sig.Parameters[i].ParameterType.ShortName);
}
result.Append(")");
@@ -54,15 +48,19 @@ public static string GetSignature(string name, MosaMethodSignature sig, bool sho
for (int i = 0; i < sig.Parameters.Count; i++)
{
if (i != 0)
result.Append(", ");
{
result.Append(",");
if (!stripSpaces)
result.Append(" ");
}
result.Append(sig.Parameters[i].ParameterType.FullName);
}
result.Append(")");
return result.ToString();
}
}

internal static void UpdateType(MosaType type)
public static void UpdateType(MosaType type)
{
var result = new StringBuilder();

@@ -72,7 +70,7 @@ internal static void UpdateType(MosaType type)
for (int i = 0; i < type.GenericArguments.Count; i++)
{
if (i != 0)
result.Append(", ");
result.Append(",");
result.Append(type.GenericArguments[i].FullName);
}
result.Append(">");
@@ -70,7 +70,7 @@ public override void Dispose()
{
if (field.FieldType != null)
{
field.FullName = string.Concat(field.FieldType.FullName, " ", field.DeclaringType.FullName, "::", field.Name);
field.FullName = string.Concat(field.DeclaringType.FullName, "::", field.Name);
field.ShortName = string.Concat(field.Name, " : ", field.FieldType.ShortName);
}
}
@@ -188,7 +188,7 @@ public override void Dispose()
}

method.ShortName = SignatureName.GetSignature(methodName.ToString(), method.Signature, true, true);
method.FullName = SignatureName.GetSignature(method.DeclaringType.FullName + "::" + methodName, method.Signature, false, true);
method.FullName = SignatureName.GetSignature(method.DeclaringType.FullName + "::" + methodName, method.Signature, false, false, true);
}
}
}
@@ -80,7 +80,7 @@ public override void Dispose()
{
if (property.PropertyType != null)
{
property.FullName = string.Concat(property.PropertyType.FullName, " ", property.DeclaringType.FullName, "::", property.Name);
property.FullName = string.Concat(property.DeclaringType.FullName, "::", property.Name);
property.ShortName = string.Concat(property.Name, " : ", property.PropertyType.ShortName);

if (GetCleanMethodName(property.Name) != GetUncleanMethodPrefix(property.Name))

0 comments on commit e7d695b

Please sign in to comment.
You can’t perform that action at this time.