Skip to content

Commit f4682fd

Browse files
committed
AssignVariableNames.GetNameFromInstruction: also handle LdFlda directly
1 parent f2b47b4 commit f4682fd

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

ICSharpCode.Decompiler/IL/Transforms/AssignVariableNames.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,11 @@ static string GetNameFromInstruction(ILInstruction inst)
226226
{
227227
switch (inst) {
228228
case LdObj ldobj:
229-
IField field;
230-
if (ldobj.Target is LdFlda ldflda)
231-
field = ldflda.Field;
232-
else if (ldobj.Target is LdsFlda ldsflda)
233-
field = ldsflda.Field;
234-
else
235-
break;
236-
return CleanUpVariableName(field.Name);
229+
return GetNameFromInstruction(ldobj.Target);
230+
case LdFlda ldflda:
231+
return CleanUpVariableName(ldflda.Field.Name);
232+
case LdsFlda ldsflda:
233+
return CleanUpVariableName(ldsflda.Field.Name);
237234
case CallInstruction call:
238235
if (call is NewObj) break;
239236
IMethod m = call.Method;

0 commit comments

Comments
 (0)