Esempio n. 1
0
        private void CreateNodesForUpperScopesIfExist()
        {
            if (_visitor.context._ctn != null)
            {
                _rootNode        = new CapturedVariablesTreeNodeClassScope(null, _visitor.context._ctn.Scope.ScopeNum, null, _visitor.context._ctn.name);
                _currentTreeNode = _rootNode;

                _scopesCapturedVarsNodesDictionary.Add(_visitor.context._ctn.Scope.ScopeNum, _currentTreeNode);

                _classScope = (CapturedVariablesTreeNodeClassScope)_rootNode;
            }

            if (_visitor.context.func_stack.top() != null)
            {
                var newTreeNode = new CapturedVariablesTreeNodeProcedureScope(_currentTreeNode, _visitor.context.func_stack.top(), _visitor.context.func_stack.top().scope.ScopeNum, null);

                if (_rootNode == null)
                {
                    _rootNode = newTreeNode;
                }
                if (_currentTreeNode != null)
                {
                    _currentTreeNode.ChildNodes.Add(newTreeNode);
                }
                _currentTreeNode = newTreeNode;

                _scopesCapturedVarsNodesDictionary.Add(_visitor.context.func_stack.top().scope.ScopeNum, _currentTreeNode);

                _procedureScope = (CapturedVariablesTreeNodeProcedureScope)_currentTreeNode;
            }
        }
        private void CreateNodesForUpperScopesIfExist()
        {
            if (_visitor.context._ctn != null)
            {
                _rootNode = new CapturedVariablesTreeNodeClassScope(null, _visitor.context._ctn.Scope.ScopeNum, null, _visitor.context._ctn.name);
                _currentTreeNode = _rootNode;

                _scopesCapturedVarsNodesDictionary.Add(_visitor.context._ctn.Scope.ScopeNum, _currentTreeNode);

                _classScope = (CapturedVariablesTreeNodeClassScope) _rootNode;
            }

            if (_visitor.context.func_stack.top() != null)
            {
                var newTreeNode = new CapturedVariablesTreeNodeProcedureScope(_currentTreeNode, _visitor.context.func_stack.top(), _visitor.context.func_stack.top().scope.ScopeNum, null);

                if (_rootNode == null)
                {
                    _rootNode = newTreeNode;
                }
                if (_currentTreeNode != null)
                {
                    _currentTreeNode.ChildNodes.Add(newTreeNode);
                }
                _currentTreeNode = newTreeNode;

                _scopesCapturedVarsNodesDictionary.Add(_visitor.context.func_stack.top().scope.ScopeNum, _currentTreeNode);

                _procedureScope = (CapturedVariablesTreeNodeProcedureScope) _currentTreeNode;
            }
        }