Browse Source

Allow inlining constants into expression trees.

pull/2069/head
Daniel Grunwald 6 years ago
parent
commit
e0fd0bba32
  1. 11
      ICSharpCode.Decompiler/IL/Instructions/ILFunction.cs

11
ICSharpCode.Decompiler/IL/Instructions/ILFunction.cs

@ -358,7 +358,16 @@ namespace ICSharpCode.Decompiler.IL
return InstructionFlags.MayThrow | InstructionFlags.ControlFlow; return InstructionFlags.MayThrow | InstructionFlags.ControlFlow;
} }
} }
internal override bool CanInlineIntoSlot(int childIndex, ILInstruction expressionBeingMoved)
{
// With expression trees, we occasionally need to inline constants into an existing expression tree.
// Only allow this for completely pure constants; a MayReadLocals effect would already be problematic
// because we're essentially delaying evaluation of the expression until the ILFunction is called.
Debug.Assert(childIndex == 0);
return kind == ILFunctionKind.ExpressionTree && expressionBeingMoved.Flags == InstructionFlags.None;
}
/// <summary> /// <summary>
/// Apply a list of transforms to this function. /// Apply a list of transforms to this function.
/// </summary> /// </summary>

Loading…
Cancel
Save