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

        public HappilLocal <T> Local <T>(IHappilOperand <T> initialValue)
        {
            var local = new HappilLocal <T>(this);

            local.Assign(initialValue);
            return(local);
        }
Example #2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        #region IHappilMember Members

        void IHappilMember.DefineBody()
        {
            m_ReturnValueLocal           = null;
            m_CurrentBodyDefinitionIndex = 0;

            var outermostDefinition = m_BodyDefinitions.First();

            using (CreateTypeTemplateScope())
            {
                using (CreateBodyScope())
                {
                    outermostDefinition();
                }
            }

            DefineReturnAttributes();
        }
Example #3
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        internal protected void AddReturnStatement(IHappilOperand <TypeTemplate.TReturn> returnValue)
        {
            if (m_CurrentBodyDefinitionIndex > 0)
            {
                if (object.ReferenceEquals(m_ReturnValueLocal, null))
                {
                    m_ReturnValueLocal = this.Local <TypeTemplate.TReturn>();
                }

                m_ReturnValueLocal.Assign(returnValue.OrNullConstant());
            }
            else
            {
                //TODO: verify that current scope belongs to this method
                StatementScope.Current.AddStatement(new ReturnStatement <TypeTemplate.TReturn>(returnValue));
            }
        }
Example #4
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public IHappilForeachInSyntax <T> Foreach <T>(HappilLocal <T> element)
        {
            return(AddStatement(new ForeachStatement <T>(element)));
        }