Skip to content

Commit f98b9d4

Browse files
committed
Revert SymbolUtils - it broke flowgraphs
1 parent e3e043b commit f98b9d4

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

Disasmo/Utils/SymbolUtils.cs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,39 @@ public class SymbolUtils
66
{
77
public static DisasmoSymbolInfo FromSymbol(ISymbol symbol)
88
{
9-
// whole class
10-
if (symbol is not IMethodSymbol ms)
11-
return new(
12-
symbol.Name + ":*",
13-
symbol.ToString(),
14-
"*");
9+
string target;
10+
string hostType;
11+
string methodName;
1512

16-
// method name is always "*" now, remove it?
17-
return ms.MethodKind switch
13+
if (symbol is IMethodSymbol ms)
1814
{
19-
MethodKind.LocalFunction =>
15+
if (ms.MethodKind == MethodKind.LocalFunction)
16+
{
2017
// hack for mangled names
21-
new("*" + symbol.Name + "*",
22-
symbol.ContainingType.ToString(),
23-
"*"),
24-
MethodKind.Constructor =>
25-
new("*" + symbol.ContainingType.Name + ":.ctor",
26-
symbol.ContainingType.ToString(),
27-
"*"),
28-
_ => new("*" + symbol.ContainingType.Name + ":" + symbol.Name,
29-
symbol.ContainingType.ToString(),
30-
"*")
31-
};
18+
target = "*" + symbol.Name + "*";
19+
hostType = symbol.ContainingType.ToString();
20+
methodName = "*";
21+
}
22+
else if (ms.MethodKind == MethodKind.Constructor)
23+
{
24+
target = "*" + symbol.ContainingType.Name + ":.ctor";
25+
hostType = symbol.ContainingType.ToString();
26+
methodName = "*";
27+
}
28+
else
29+
{
30+
target = "*" + symbol.ContainingType.Name + ":" + symbol.Name;
31+
hostType = symbol.ContainingType.ToString();
32+
methodName = symbol.Name;
33+
}
34+
}
35+
else
36+
{
37+
// the whole class
38+
target = symbol.Name + ":*";
39+
hostType = symbol.ToString();
40+
methodName = "*";
41+
}
42+
return new DisasmoSymbolInfo(target, hostType, methodName);
3243
}
3344
}

0 commit comments

Comments
 (0)