Browse Source

Fix handling of 'volatile' prefix

pull/728/head
Daniel Grunwald 10 years ago
parent
commit
fe00e10a58
  1. 10
      ICSharpCode.Decompiler/IL/ILReader.cs

10
ICSharpCode.Decompiler/IL/ILReader.cs

@ -771,7 +771,7 @@ namespace ICSharpCode.Decompiler.IL
{ {
byte alignment = reader.ReadByte(); byte alignment = reader.ReadByte();
var inst = DecodeInstruction(); var inst = DecodeInstruction();
var sup = inst as ISupportsUnalignedPrefix; var sup = UnpackVoid(inst) as ISupportsUnalignedPrefix;
if (sup != null) if (sup != null)
sup.UnalignedPrefix = alignment; sup.UnalignedPrefix = alignment;
else else
@ -782,13 +782,19 @@ namespace ICSharpCode.Decompiler.IL
private ILInstruction DecodeVolatile() private ILInstruction DecodeVolatile()
{ {
var inst = DecodeInstruction(); var inst = DecodeInstruction();
var svp = inst as ISupportsVolatilePrefix; var svp = UnpackVoid(inst) as ISupportsVolatilePrefix;
if (svp != null) if (svp != null)
svp.IsVolatile = true; svp.IsVolatile = true;
else else
Warn("Ignored invalid 'volatile' prefix"); Warn("Ignored invalid 'volatile' prefix");
return inst; return inst;
} }
ILInstruction UnpackVoid(ILInstruction inst)
{
Void v = inst as Void;
return v != null ? v.Argument : inst;
}
private ILInstruction DecodeReadonly() private ILInstruction DecodeReadonly()
{ {

Loading…
Cancel
Save