From e59edceccb33256ffcf84b1b3e4cc3a2b5c85e89 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Mon, 23 May 2011 17:19:00 +0200 Subject: [PATCH] Fix inlining into null coalescing operator. --- ICSharpCode.Decompiler/ILAst/ILInlining.cs | 2 +- ICSharpCode.Decompiler/ILAst/SimpleControlFlow.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.Decompiler/ILAst/ILInlining.cs b/ICSharpCode.Decompiler/ILAst/ILInlining.cs index d839f41ef..be749a658 100644 --- a/ICSharpCode.Decompiler/ILAst/ILInlining.cs +++ b/ICSharpCode.Decompiler/ILAst/ILInlining.cs @@ -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]; diff --git a/ICSharpCode.Decompiler/ILAst/SimpleControlFlow.cs b/ICSharpCode.Decompiler/ILAst/SimpleControlFlow.cs index 319e18bbb..f7f2cf8a3 100644 --- a/ICSharpCode.Decompiler/ILAst/SimpleControlFlow.cs +++ b/ICSharpCode.Decompiler/ILAst/SimpleControlFlow.cs @@ -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