Browse Source

Fix naming of stack slots generated by ILReader.Push.

pull/870/merge
Siegfried Pammer 8 years ago
parent
commit
38c0981233
  1. 1
      ICSharpCode.Decompiler/IL/ILReader.cs
  2. 2
      ICSharpCode.Decompiler/IL/ILVariable.cs

1
ICSharpCode.Decompiler/IL/ILReader.cs

@ -880,6 +880,7 @@ namespace ICSharpCode.Decompiler.IL
IType type = compilation.FindType(inst.ResultType.ToKnownTypeCode()); IType type = compilation.FindType(inst.ResultType.ToKnownTypeCode());
var v = new ILVariable(VariableKind.StackSlot, type, inst.ResultType, inst.ILRange.Start); var v = new ILVariable(VariableKind.StackSlot, type, inst.ResultType, inst.ILRange.Start);
v.Name = "S_" + inst.ILRange.Start.ToString("x4"); v.Name = "S_" + inst.ILRange.Start.ToString("x4");
v.HasGeneratedName = true;
currentStack = currentStack.Push(v); currentStack = currentStack.Push(v);
return new StLoc(v, inst); return new StLoc(v, inst);
} }

2
ICSharpCode.Decompiler/IL/ILVariable.cs

@ -267,6 +267,8 @@ namespace ICSharpCode.Decompiler.IL
public ILVariable(VariableKind kind, IType type, StackType stackType, int index) public ILVariable(VariableKind kind, IType type, StackType stackType, int index)
{ {
if (type == null)
throw new ArgumentNullException(nameof(type));
this.Kind = kind; this.Kind = kind;
this.type = type; this.type = type;
this.StackType = stackType; this.StackType = stackType;

Loading…
Cancel
Save