//----------------------------------------------------------------------------------------------------------------------------------------------------- public override void Emit(ILGenerator il) { var arguments = new IOperand[m_OwnerMethod.Signature.ArgumentCount]; m_OwnerMethod.TransparentWriter.ForEachArgument((arg, index) => arguments[index] = arg); Helpers.EmitCall(il, m_Target, m_OwnerMethod.MethodDeclaration, arguments); if (!m_OwnerMethod.IsVoid && !object.ReferenceEquals(m_ReturnValueLocal, null)) { m_ReturnValueLocal.EmitStore(il); } }
//------------------------------------------------------------------------------------------------------------------------------------------------- private void EmitPrefixVersion(ILGenerator il, IOperand <T> operand) { if (operand.HasTarget) { operand.EmitTarget(il); il.Emit(OpCodes.Dup); } EmitIncrement(il, operand); if (operand.HasTarget && m_ShouldLeaveValueOnStack) { var temp = m_StatementScope.AddLocal <T>(); temp.EmitStore(il); operand.EmitStore(il); temp.EmitLoad(il); } else { operand.EmitStore(il); } }
//------------------------------------------------------------------------------------------------------------------------------------------------- private void EmitPostfixVersion(ILGenerator il, IOperand <T> operand) { operand.EmitTarget(il); EmitIncrement(il, operand); if (operand.HasTarget) { var temp = m_StatementScope.AddLocal <T>(); temp.EmitStore(il); operand.EmitTarget(il); temp.EmitLoad(il); } operand.EmitStore(il); }
//------------------------------------------------------------------------------------------------------------------------------------------------- public void Emit(ILGenerator il, IOperand <T> left, IOperand <T> right) { var nonPostfix = (left as INonPostfixNotation); left.EmitTarget(il); if (nonPostfix != null) { nonPostfix.RightSide = right; } else { right.EmitTarget(il); right.EmitLoad(il); } left.EmitStore(il); if (m_ForceLeaveFalueOnStack) { left.EmitTarget(il); left.EmitLoad(il); } }