Browse Source

Fix inlining into null coalescing operator.

pull/182/merge
Daniel Grunwald 15 years ago
parent
commit
e59edceccb
  1. 2
      ICSharpCode.Decompiler/ILAst/ILInlining.cs
  2. 2
      ICSharpCode.Decompiler/ILAst/SimpleControlFlow.cs

2
ICSharpCode.Decompiler/ILAst/ILInlining.cs

@ -385,7 +385,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -385,7 +385,7 @@ namespace ICSharpCode.Decompiler.ILAst
for (int i = 0; i < expr.Arguments.Count; i++) {
// Stop when seeing an opcode that does not guarantee that its operands will be evaluated.
// Inlining in that case might result in the inlined expresion not being evaluted.
if (i == 1 && (expr.Code == ILCode.LogicAnd || expr.Code == ILCode.LogicOr || expr.Code == ILCode.TernaryOp))
if (i == 1 && (expr.Code == ILCode.LogicAnd || expr.Code == ILCode.LogicOr || expr.Code == ILCode.TernaryOp || expr.Code == ILCode.NullCoalescing))
return false;
ILExpression arg = expr.Arguments[i];

2
ICSharpCode.Decompiler/ILAst/SimpleControlFlow.cs

@ -306,7 +306,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -306,7 +306,7 @@ namespace ICSharpCode.Decompiler.ILAst
if (!opBitwiseCallExpr.Match(ILCode.Call, out opBitwise, out leftVarExpression, out rightExpression))
return false;
if (!opFalseArg.MatchLdloc(leftVarExpression.Operand as ILVariable))
if (!leftVarExpression.MatchLdloc(leftVar))
return false;
// ignore operators other than op_BitwiseAnd and op_BitwiseOr

Loading…
Cancel
Save