Refactored mangling function
Utilizes a string builder instead of shitty String.Concat trickery
This commit is contained in:
parent
1d324baf9d
commit
db6739be42
1 changed files with 10 additions and 10 deletions
|
@ -216,18 +216,18 @@ namespace arookas {
|
||||||
|
|
||||||
// static util
|
// static util
|
||||||
string MangleSymbolName(string basename, bool system, bool local) {
|
string MangleSymbolName(string basename, bool system, bool local) {
|
||||||
var prefix = "";
|
if (!system && !local) {
|
||||||
var suffix = "";
|
|
||||||
if (system) {
|
|
||||||
prefix = "$";
|
|
||||||
}
|
|
||||||
if (local) {
|
|
||||||
suffix = String.Format("@{0}", mLocalStack.Peek());
|
|
||||||
}
|
|
||||||
if (prefix == "" && suffix == "") {
|
|
||||||
return basename;
|
return basename;
|
||||||
}
|
}
|
||||||
return String.Concat(prefix, basename, suffix);
|
var sb = new StringBuilder(basename.Length + 16);
|
||||||
|
if (system) {
|
||||||
|
sb.Append('$');
|
||||||
|
}
|
||||||
|
sb.Append(basename);
|
||||||
|
if (local) {
|
||||||
|
sb.AppendFormat("@{0}", mLocalStack.Peek());
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue