//----------------------------------------------------------------------------------------------------------------------------------------------------- protected MethodWriterBase(MethodMember ownerMethod, MethodWriterModes mode, bool attachToOwner) { m_OwnerMethod = ownerMethod; m_Mode = mode; m_ReturnValueLocal = null; m_InnerWriters = null; if (ownerMethod != null) { m_OwnerClass = ownerMethod.OwnerClass; if (attachToOwner) { ownerMethod.AddWriter(this); } } }
//----------------------------------------------------------------------------------------------------------------------------------------------------- public ProceedStatement(MethodMember ownerMethod, MethodWriterBase[] decoratedWriters, IMutableOperand returnValueLocal) { m_OwnerMethod = ownerMethod; m_DecoratedStatements = new StatementBlock(); m_ReturnValueLocal = returnValueLocal; using (var scope = new StatementScope(m_DecoratedStatements /*, exceptionStatement: null, blockType: ExceptionBlockType.None*/)) { m_LeaveLabel = scope.DefineLabel(); foreach (var writer in decoratedWriters) { writer.SetupDecoratedMode(returnValueLocal, m_LeaveLabel); writer.Flush(); } m_LeaveLabel.MarkLabel(); } }
//----------------------------------------------------------------------------------------------------------------------------------------------------- internal void SetupDecoratedMode(IMutableOperand returnValueLocal, LabelStatement leaveLabel) { m_Mode |= MethodWriterModes.Decorated; m_ReturnValueLocal = returnValueLocal; m_LeaveLabel = leaveLabel; }