Example #1
0
        /// <summary>
        /// Open a new scope for the block and visit the body. Pop the scope when we're done.
        /// </summary>
        /// <param name="n"></param>
        public override void VisitBlock(ASTBlock n)
        {
            //a hack to get around scoping declared variables properly in for loops
            if (!_skipNextBlockScope)
            {
                _scopeMgr.PushScope("block");
                _currentMethod.AddBlock(n.IsBranch);
            }
            else
            {
                _skipNextBlockScope = false;
            }

            CheckSubTree(n.Body);

            _currentMethod.LeaveBlock();
            _scopeMgr.PopScope();
        }