MCPcopy
hub / github.com/microsoft/pyright / _doSemanticAnalysis

Method _doSemanticAnalysis

server/src/analyzer/program.ts:229–250  ·  view source on GitHub ↗
(fileToAnalyze: SourceFileInfo, options: ConfigOptions)

Source from the content-addressed store, hash-verified

227 }
228
229 private _doSemanticAnalysis(fileToAnalyze: SourceFileInfo, options: ConfigOptions) {
230 if (!this._isFileNeeded(fileToAnalyze) || !fileToAnalyze.sourceFile.isSemanticAnalysisRequired()) {
231 return;
232 }
233
234 this._parseFile(fileToAnalyze, options);
235
236 // We need to parse and semantically analyze the builtins import first.
237 let builtinsScope: Scope | undefined;
238 if (fileToAnalyze.builtinsImport) {
239 this._doSemanticAnalysis(fileToAnalyze.builtinsImport, options);
240
241 // Get the builtins scope to pass to the semantic analyzer pass.
242 const parseResults = fileToAnalyze.builtinsImport.sourceFile.getParseResults();
243 if (parseResults) {
244 builtinsScope = AnalyzerNodeInfo.getScope(parseResults.parseTree);
245 assert(builtinsScope !== undefined);
246 }
247 }
248
249 fileToAnalyze.sourceFile.doSemanticAnalysis(options, builtinsScope);
250 }
251
252 private _doFullAnalysis(fileToAnalyze: SourceFileInfo, options: ConfigOptions,
253 timeElapsedCallback: () => boolean): boolean {

Callers 2

analyzeMethod · 0.95

Calls 6

_isFileNeededMethod · 0.95
_parseFileMethod · 0.95
getParseResultsMethod · 0.80
getScopeMethod · 0.80
doSemanticAnalysisMethod · 0.80

Tested by

no test coverage detected