Example #1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        private void InsertStatementToBlock(StatementBase statement)
        {
            if (m_IsRewriteMode)
            {
                m_StatementBlock.Insert(m_RewriteInsertionIndex++, statement);
            }
            else
            {
                m_StatementBlock.Add(statement);
            }
        }
Example #2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public void AddStatement(StatementBase statement)
        {
            var effectiveStatementToAdd = statement;
            var leaveStatement          = (statement as ILeaveStatement);

            if (leaveStatement != null && m_InheritedExceptionBlockType != ExceptionBlockType.None)
            {
                var tryStatement = FindOutermostTryStatementWithin(leaveStatement.HomeScope);

                if (tryStatement != null)
                {
                    effectiveStatementToAdd = tryStatement.WrapLeaveStatement(leaveStatement);
                }
            }

            InsertStatementToBlock(effectiveStatementToAdd);
        }