Example #1
0
        public void EnterMethodDefinition(
            ScopeBuilder /*!*/ locals,
            MSA.Expression /*!*/ selfParameter,
            MSA.ParameterExpression /*!*/ runtimeScopeVariable,
            MSA.Expression blockParameter,
            string /*!*/ methodName,
            Parameters parameters)
        {
            Assert.NotNull(locals, selfParameter, runtimeScopeVariable);

            MethodScope method = new MethodScope(
                locals,
                selfParameter,
                runtimeScopeVariable,
                blockParameter,
                methodName,
                parameters
                );

            method.Parent              = _currentElement;
            method.ParentRescue        = _currentRescue;
            method.ParentLoop          = _currentLoop;
            method.ParentBlock         = _currentBlock;
            method.ParentVariableScope = _currentVariableScope;
            method.ParentMethod        = _currentMethod;

            _currentElement       = method;
            _currentRescue        = null;
            _currentLoop          = null;
            _currentBlock         = null;
            _currentVariableScope = method;
            _currentMethod        = method;
        }
Example #2
0
        public void LeaveBlockDefinition()
        {
            Debug.Assert(_currentElement == _currentBlock);
            BlockScope oldBlock = _currentBlock;

            _currentElement       = oldBlock.Parent;
            _currentRescue        = oldBlock.ParentRescue;
            _currentLoop          = oldBlock.ParentLoop;
            _currentVariableScope = oldBlock.ParentVariableScope;
            _currentBlock         = oldBlock.ParentBlock;
        }
Example #3
0
        public void EnterRescueClause(MSA.Expression /*!*/ retryingVariable, MSA.LabelTarget /*!*/ breakLabel, MSA.LabelTarget /*!*/ continueLabel)
        {
            Assert.NotNull(retryingVariable, breakLabel, continueLabel);

            RescueScope body = new RescueScope(retryingVariable, breakLabel, continueLabel);

            body.Parent       = _currentElement;
            body.ParentRescue = _currentRescue;

            _currentElement = _currentRescue = body;
        }
Example #4
0
        public void LeaveMethodDefinition()
        {
            Debug.Assert(_currentElement == _currentMethod);
            MethodScope oldMethod = _currentMethod;

            _currentElement       = oldMethod.Parent;
            _currentRescue        = oldMethod.ParentRescue;
            _currentLoop          = oldMethod.ParentLoop;
            _currentBlock         = oldMethod.ParentBlock;
            _currentVariableScope = oldMethod.ParentVariableScope;
            _currentMethod        = oldMethod.ParentMethod;
        }
Example #5
0
        public void EnterBlockDefinition(
            ScopeBuilder /*!*/ locals,
            MSA.Expression /*!*/ bfcVariable,
            MSA.Expression /*!*/ selfVariable,
            MSA.Expression /*!*/ runtimeScopeVariable,
            MSA.LabelTarget /*!*/ redoLabel)
        {
            Assert.NotNull(locals, bfcVariable, selfVariable);
            Assert.NotNull(redoLabel);

            BlockScope block = new BlockScope(locals, selfVariable, runtimeScopeVariable, bfcVariable, redoLabel);

            block.Parent              = _currentElement;
            block.ParentRescue        = _currentRescue;
            block.ParentLoop          = _currentLoop;
            block.ParentBlock         = _currentBlock;
            block.ParentVariableScope = _currentVariableScope;

            _currentElement       = block;
            _currentRescue        = null;
            _currentLoop          = null;
            _currentBlock         = block;
            _currentVariableScope = block;
        }
Example #6
0
        public void LeaveMethodDefinition() {
            Debug.Assert(_currentElement == _currentMethod);
            MethodScope oldMethod = _currentMethod;

            _currentElement = oldMethod.Parent;
            _currentRescue = oldMethod.ParentRescue;
            _currentLoop = oldMethod.ParentLoop;
            _currentBlock = oldMethod.ParentBlock;
            _currentVariableScope = oldMethod.ParentVariableScope;
            _currentMethod = oldMethod.ParentMethod;
        }
Example #7
0
        public void EnterMethodDefinition(
            ScopeBuilder/*!*/ locals, 
            MSA.Expression/*!*/ selfParameter,
            MSA.ParameterExpression/*!*/ runtimeScopeVariable,
            MSA.Expression blockParameter,
            string/*!*/ methodName,
            Parameters parameters) {
            Assert.NotNull(locals, selfParameter, runtimeScopeVariable);

            MethodScope method = new MethodScope(
                locals,
                selfParameter, 
                runtimeScopeVariable, 
                blockParameter, 
                methodName, 
                parameters
            );

            method.Parent = _currentElement;
            method.ParentRescue = _currentRescue;
            method.ParentLoop = _currentLoop;
            method.ParentBlock = _currentBlock;
            method.ParentVariableScope = _currentVariableScope;
            method.ParentMethod = _currentMethod;

            _currentElement = method;
            _currentRescue = null;
            _currentLoop = null;
            _currentBlock = null;
            _currentVariableScope = method;
            _currentMethod = method;
        }
Example #8
0
        public void LeaveBlockDefinition() {
            Debug.Assert(_currentElement == _currentBlock);
            BlockScope oldBlock = _currentBlock;

            _currentElement = oldBlock.Parent;
            _currentRescue = oldBlock.ParentRescue;
            _currentLoop = oldBlock.ParentLoop;
            _currentVariableScope = oldBlock.ParentVariableScope;
            _currentBlock = oldBlock.ParentBlock;
        }
Example #9
0
        public void EnterBlockDefinition(
            ScopeBuilder/*!*/ locals,
            MSA.Expression/*!*/ bfcVariable,
            MSA.Expression/*!*/ selfVariable,
            MSA.ParameterExpression/*!*/ runtimeScopeVariable, 
            MSA.LabelTarget/*!*/ redoLabel) {
            Assert.NotNull(locals, bfcVariable, selfVariable);
            Assert.NotNull(redoLabel);

            BlockScope block = new BlockScope(locals, selfVariable, runtimeScopeVariable, bfcVariable, redoLabel);
            block.Parent = _currentElement;
            block.ParentRescue = _currentRescue;
            block.ParentLoop = _currentLoop;
            block.ParentBlock = _currentBlock;
            block.ParentVariableScope = _currentVariableScope;
            
            _currentElement = block;
            _currentRescue = null;
            _currentLoop = null;
            _currentBlock = block;
            _currentVariableScope = block;
        }
Example #10
0
 public void LeaveRescueClause() {
     Debug.Assert(_currentElement == _currentRescue);
     _currentElement = _currentRescue.Parent;
     _currentRescue = _currentRescue.ParentRescue;
 }
Example #11
0
        public void EnterRescueClause(MSA.Expression/*!*/ retryingVariable, MSA.LabelTarget/*!*/ retryLabel) {
            Assert.NotNull(retryingVariable, retryLabel);

            RescueScope body = new RescueScope(retryingVariable, retryLabel);

            body.Parent = _currentElement;
            body.ParentRescue = _currentRescue;

            _currentElement = _currentRescue = body;
        }
Example #12
0
 public void LeaveRescueClause()
 {
     Debug.Assert(_currentElement == _currentRescue);
     _currentElement = _currentRescue.Parent;
     _currentRescue  = _currentRescue.ParentRescue;
 }