From db6739be42439f29cbf99e3c9384d61dd1a2985a Mon Sep 17 00:00:00 2001 From: arookas Date: Mon, 1 Feb 2016 15:50:46 -0500 Subject: [PATCH] Refactored mangling function Utilizes a string builder instead of shitty String.Concat trickery --- ssc/context.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ssc/context.cs b/ssc/context.cs index 634c974..1d42095 100644 --- a/ssc/context.cs +++ b/ssc/context.cs @@ -216,18 +216,18 @@ namespace arookas { // static util string MangleSymbolName(string basename, bool system, bool local) { - var prefix = ""; - var suffix = ""; - if (system) { - prefix = "$"; - } - if (local) { - suffix = String.Format("@{0}", mLocalStack.Peek()); - } - if (prefix == "" && suffix == "") { + if (!system && !local) { 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(); } } }