Beispiel #1
0
 internal ExpressionAnalysis(string expression, ModuleAnalysis analysis, int lineNo, ITrackingSpan span)
 {
     _expr = expression;
     _analysis = analysis;
     _lineNo = lineNo;
     _span = span;
 }
Beispiel #2
0
        private void Parse()
        {
            if (_tree == null)
            {
                return;
            }

            var oldParent = _myScope.ParentPackage;

            ProjectState.ModulesByFilename[_filePath] = _myScope;

            if (oldParent != null)
            {
                // update us in our parent package
                _myScope.ParentPackage = oldParent;
                oldParent.Scope.SetVariable(_tree, _unit, _moduleName.Substring(_moduleName.IndexOf('.') + 1), _myScope.SelfSet, false);
            }

            var unit = _unit = new AnalysisUnit(_tree, new InterpreterScope[] { _myScope.Scope }, null);

            // collect top-level definitions first
            var walker = new OverviewWalker(this, unit);

            _tree.Walk(walker);
            _scopeTree = walker.ScopeTree;

            PublishPackageChildrenInPackage();

            // create new analysis object and analyze the code.
            var newAnalysis = new ModuleAnalysis(_unit, _scopeTree);

            _unit.Enqueue();

            new DDG().Analyze(_projectState.Queue);

            // publish the analysis now that it's complete
            _currentAnalysis = newAnalysis;

            foreach (var variableInfo in _myScope.Scope.Variables)
            {
                variableInfo.Value.ClearOldValues(this);
            }
        }
Beispiel #3
0
        private void Parse()
        {
            if (_tree == null) {
                return;
            }

            var oldParent = _myScope.ParentPackage;
            ProjectState.ModulesByFilename[_filePath] = _myScope;

            if (oldParent != null) {
                // update us in our parent package
                _myScope.ParentPackage = oldParent;
                oldParent.Scope.SetVariable(_tree, _unit, _moduleName.Substring(_moduleName.IndexOf('.') + 1), _myScope.SelfSet, false);
            }

            var unit = _unit = new AnalysisUnit(_tree, new InterpreterScope[] { _myScope.Scope }, null);

            // collect top-level definitions first
            var walker = new OverviewWalker(this, unit);
            _tree.Walk(walker);
            _scopeTree = walker.ScopeTree;

            PublishPackageChildrenInPackage();

            // create new analysis object and analyze the code.
            var newAnalysis = new ModuleAnalysis(_unit, _scopeTree);
            _unit.Enqueue();

            new DDG().Analyze(_projectState.Queue);

            // publish the analysis now that it's complete
            _currentAnalysis = newAnalysis;

            foreach (var variableInfo in _myScope.Scope.Variables) {
                variableInfo.Value.ClearOldValues(this);
            }
        }