Browse Source

Handle ldelem.any. Closes #47.

pull/70/head
Daniel Grunwald 15 years ago
parent
commit
db44cd1d3b
  1. 3
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
  2. 2
      ICSharpCode.Decompiler/ILAst/ILInlining.cs

3
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -349,9 +349,8 @@ namespace Decompiler
case Code.Ldelem_R4: case Code.Ldelem_R4:
case Code.Ldelem_R8: case Code.Ldelem_R8:
case Code.Ldelem_Ref: case Code.Ldelem_Ref:
return arg1.Indexer(arg2);
case Code.Ldelem_Any: case Code.Ldelem_Any:
return InlineAssembly(byteCode, args); return arg1.Indexer(arg2);
case Code.Ldelema: case Code.Ldelema:
return MakeRef(arg1.Indexer(arg2)); return MakeRef(arg1.Indexer(arg2));

2
ICSharpCode.Decompiler/ILAst/ILInlining.cs

@ -50,7 +50,7 @@ namespace Decompiler
{ {
if (expr.Code != ILCode.Stloc) if (expr.Code != ILCode.Stloc)
throw new ArgumentException("expr must be stloc"); throw new ArgumentException("expr must be stloc");
// ensure the variable is only accessed only a single time // ensure the variable is accessed only a single time
if (method.GetSelfAndChildrenRecursive<ILExpression>().Count(e => e != expr && e.Operand == expr.Operand) != 1) if (method.GetSelfAndChildrenRecursive<ILExpression>().Count(e => e != expr && e.Operand == expr.Operand) != 1)
return false; return false;
ILExpression parent; ILExpression parent;

Loading…
Cancel
Save