private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, PythonAst ast, int version) { // Now run the analysis. var analyzable = module as IAnalyzable; analyzable?.NotifyAnalysisBegins(); var walker = new ModuleWalker(_services, module, ast); ast.Walk(walker); _analyzerCancellationToken.ThrowIfCancellationRequested(); walker.Complete(); _analyzerCancellationToken.ThrowIfCancellationRequested(); var analysis = new DocumentAnalysis((IDocument)module, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); analyzable?.NotifyAnalysisComplete(analysis); entry.TrySetAnalysis(analysis, version); if (module.ModuleType == ModuleType.User) { var linterDiagnostics = _analyzer.LintModule(module); _diagnosticsService?.Replace(entry.Module.Uri, linterDiagnostics, DiagnosticSource.Linter); } }
private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int version, bool isFinalPass) { if (entry.PreviousAnalysis is LibraryAnalysis) { _log?.Log(TraceEventType.Verbose, $"Request to re-analyze finalized {module.Name}."); } // Now run the analysis. var analyzable = module as IAnalyzable; analyzable?.NotifyAnalysisBegins(); var ast = module.GetAst(); var walker = new ModuleWalker(_services, module); ast.Walk(walker); _analyzerCancellationToken.ThrowIfCancellationRequested(); walker.Complete(); _analyzerCancellationToken.ThrowIfCancellationRequested(); analyzable?.NotifyAnalysisComplete(version, walker, isFinalPass); entry.TrySetAnalysis(module.Analysis, version); if (module.ModuleType == ModuleType.User) { var linterDiagnostics = _analyzer.LintModule(module); _diagnosticsService?.Replace(entry.Module.Uri, linterDiagnostics, DiagnosticSource.Linter); } }
private IDocumentAnalysis DoAnalyzeEntry(IDependencyChainNode <PythonAnalyzerEntry> node, IPythonModule module, PythonAst ast, int version) { var analysis = TryRestoreCachedAnalysis(node, module); if (analysis != null) { return(analysis); } var walker = new ModuleWalker(_services, module, ast, _analyzerCancellationToken); ast.Walk(walker); walker.Complete(); return(CreateAnalysis(node, (IDocument)module, ast, version, walker)); }
private void AnalyzeEntry(IDependencyChainNode <PythonAnalyzerEntry> node, PythonAnalyzerEntry entry, IPythonModule module, PythonAst ast, int version) { // Now run the analysis. var analyzable = module as IAnalyzable; analyzable?.NotifyAnalysisBegins(); var walker = new ModuleWalker(_services, module, ast); ast.Walk(walker); _analyzerCancellationToken.ThrowIfCancellationRequested(); walker.Complete(); _analyzerCancellationToken.ThrowIfCancellationRequested(); bool isCanceled; lock (_syncObj) { isCanceled = _isCanceled; } if (!isCanceled) { node?.MarkWalked(); } var analysis = CreateAnalysis(node, (IDocument)module, ast, version, walker, isCanceled); analyzable?.NotifyAnalysisComplete(analysis); entry.TrySetAnalysis(module.Analysis, version); if (module.ModuleType == ModuleType.User) { var linterDiagnostics = _analyzer.LintModule(module); _diagnosticsService?.Replace(entry.Module.Uri, linterDiagnostics, DiagnosticSource.Linter); } }