Skip to content

Commit

Permalink
remove unnecessary code (#78171)
Browse files Browse the repository at this point in the history
  • Loading branch information
thaystg authored Nov 11, 2022
1 parent f09e7ac commit ce0b82e
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,8 +1186,7 @@ internal SourceFile(AssemblyInfo assembly, int id, DocumentHandle docHandle, Uri
this.DebuggerFileName = url.Replace("\\", "/").Replace(":", "");
this.BreakableLines = new List<int>();

var urlWithSpecialCharCodedHex = EscapeAscii(url);
this.SourceUri = new Uri((Path.IsPathRooted(url) ? "file://" : "") + urlWithSpecialCharCodedHex, UriKind.RelativeOrAbsolute);
this.SourceUri = new Uri((Path.IsPathRooted(url) ? "file://" : "") + url, UriKind.RelativeOrAbsolute);
if (SourceUri.IsFile && File.Exists(SourceUri.LocalPath))
{
this.Url = this.SourceUri.ToString();
Expand All @@ -1198,33 +1197,6 @@ internal SourceFile(AssemblyInfo assembly, int id, DocumentHandle docHandle, Uri
}
}

private static string EscapeAscii(string path)
{
var builder = new StringBuilder();
foreach (char c in path)
{
switch (c)
{
case var _ when c >= 'a' && c <= 'z':
case var _ when c >= 'A' && c <= 'Z':
case var _ when char.IsDigit(c):
case var _ when c > 255:
case var _ when c == '+' || c == ':' || c == '.' || c == '-' || c == '_' || c == '~':
builder.Append(c);
break;
case var _ when c == Path.DirectorySeparatorChar:
case var _ when c == Path.AltDirectorySeparatorChar:
case var _ when c == '\\':
builder.Append(c);
break;
default:
builder.AppendFormat("%{0:X2}", (int)c);
break;
}
}
return builder.ToString();
}

internal void AddMethod(MethodInfo mi)
{
if (!this.methods.ContainsKey(mi.Token))
Expand Down

0 comments on commit ce0b82e

Please sign in to comment.