Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

AST analyzer and assemblies split #465

Merged
merged 180 commits into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
8bd5303
Types hierarchy cleanup
Nov 14, 2018
7cd781f
Test fixes, part I
Nov 14, 2018
91bde57
Restore IPythonBoundFunction
Nov 14, 2018
07ec4d4
Fix function instance types
Nov 15, 2018
1be750c
More fixes
Nov 15, 2018
0322c43
Fix overload handling
Nov 15, 2018
804a460
Fix properties
Nov 15, 2018
b9fbe7a
Fix type factory
Nov 17, 2018
49afe21
Remove class built-in type
Nov 17, 2018
3f855ac
Simplify builtins, remove obsolete method
Nov 19, 2018
2df9c05
Fix typeshed merge
Nov 20, 2018
c663ce8
Merge master
Nov 21, 2018
a2eb6f2
Allow declaring module to be null
Nov 21, 2018
133faaa
Correct assertion
Nov 26, 2018
3ba26fc
Simplify functions/methods
Nov 27, 2018
4986aaf
Fix stub merge tests
Nov 27, 2018
37c2830
Fix tests
Nov 28, 2018
dccd44d
Merge branch 'master' of https://github.com/Microsoft/python-language…
Nov 28, 2018
ad459bb
Baselines
Nov 28, 2018
dab1e22
Null ref
Nov 28, 2018
ca5aecf
Build break
Nov 28, 2018
bf1d77c
Overrides signatures
Nov 29, 2018
90e06d7
Fix typeinfo tests
Nov 29, 2018
b45ed3a
PR feedback
Nov 29, 2018
5b4f265
Infra to separate assembly
Nov 29, 2018
557eee7
Parser to own assembly
Nov 29, 2018
921c595
Parser tests to own assembly
Nov 30, 2018
ebda058
Unify to IndexSpan
Nov 30, 2018
b79b8c9
Better handle overloads
Dec 2, 2018
cbcf285
Merge branch 'analysis2' into analysis3
Dec 2, 2018
58405f9
Reorg, part I
Dec 2, 2018
190da75
Part II
Dec 2, 2018
ee0c612
Part III
Dec 3, 2018
e8a2df9
Part 4
Dec 4, 2018
eb8358d
Part 5
Dec 4, 2018
b15e821
Merge master
Dec 4, 2018
81720ef
Build breaks
Dec 4, 2018
5287ff0
Baselines
Dec 4, 2018
3dfff43
PR fix
Dec 4, 2018
6733fb8
Merge master
Dec 4, 2018
af1c64b
Merge build issues
Dec 4, 2018
6941e7d
Part 6
Dec 4, 2018
98067f1
Part 7
Dec 4, 2018
c12df18
Buildable
Dec 5, 2018
500e969
PR feedback
Dec 5, 2018
dd2f114
Merge master
Dec 5, 2018
b829969
Merge conflict
Dec 5, 2018
780757a
Fix #446
Dec 5, 2018
7bf1f38
Fix #446
Dec 5, 2018
710fc18
Merge branch 'analysis2' into analysis5
Dec 5, 2018
6fb8ef6
Part 8
Dec 6, 2018
32616d5
Part 9
Dec 6, 2018
aca9aea
Buildable
Dec 6, 2018
60bc841
Part 10
Dec 7, 2018
f3ac892
Part 11
Dec 7, 2018
6c62582
Part 12
Dec 8, 2018
4de6d73
Buildable
Dec 8, 2018
9f21d05
Part 14
Dec 8, 2018
542a469
First passing test
Dec 8, 2018
7a53a17
Simplify configuration
Dec 8, 2018
8badc5e
Style
Dec 8, 2018
e6d1e69
Fix test and move code to folders
Dec 9, 2018
f714cda
Builtins import
Dec 9, 2018
bba86a6
Fluents
Dec 10, 2018
e107d9c
Add search path
Dec 10, 2018
5815db9
Import analysis, part I
Dec 11, 2018
cccc6d8
Simplify builtins handling
Dec 11, 2018
281c293
Remove IMember
Dec 11, 2018
f42a5ce
Handle import specific
Dec 11, 2018
97092b5
More tests
Dec 11, 2018
f3df3fc
Add typeshed
Dec 12, 2018
cd3101b
Renames
Dec 12, 2018
a3c99bd
Make sure lazy modules are loaded
Dec 12, 2018
e9b737f
Renames
Dec 12, 2018
4c05da9
Move/rename
Dec 12, 2018
b29dd46
Rework importing
Dec 12, 2018
f4d4ea9
Derivation rework
Dec 13, 2018
fc27d94
Part 2
Dec 13, 2018
93fc881
Part 3
Dec 14, 2018
ec14152
Buildable
Dec 14, 2018
fdb79eb
Module members
Dec 15, 2018
fa180b7
Async walk
Dec 15, 2018
bcafc30
Imports test pass
Dec 15, 2018
dfafb94
Remove lazy types
Dec 15, 2018
39a396a
Fix from import
Dec 16, 2018
75bd509
Stubs
Dec 16, 2018
81d412a
Double overloads
Dec 17, 2018
1e1ce6a
Fix datetime test
Dec 17, 2018
fa08d5d
Merge master
Dec 17, 2018
6f80ebe
Couple more tests + fluents
Dec 17, 2018
4d0f002
Few more tests
Dec 17, 2018
d297e0f
Additionl test + union type
Dec 18, 2018
36fec2b
Built-in scrape tests
Dec 18, 2018
e6fd49e
Full stdlib scrape test
Dec 18, 2018
8673af0
Complete async AST walker
Dec 18, 2018
f6c1ce0
Conditional defines test + variable loc cleanup
Dec 19, 2018
4e30b36
More stub tests
Dec 19, 2018
d7c0672
Add some (broken mostly) tests from DDG
Dec 20, 2018
b615659
Move document tests
Dec 20, 2018
7a1d6e2
Function arg eval, part I
Dec 20, 2018
d3c8ec2
Instance/factory
Dec 21, 2018
84e8d78
Builds
Dec 22, 2018
dfe6c15
Test fixes
Dec 22, 2018
7cc74a2
Fix static and instance call eval
Dec 23, 2018
b6cb3dd
More tests
Dec 23, 2018
d3be9a6
More ported tests
Dec 24, 2018
55654f1
Specialize builtin functions
Dec 24, 2018
27c0336
Make walkers common and handle nested functions
Dec 25, 2018
55c4703
Moar tests
Dec 26, 2018
a5b104f
Parser fixes + more tests
Dec 26, 2018
078e675
Handle negative numbers
Dec 26, 2018
9137e79
Fix null ref
Dec 26, 2018
dc69e23
Basic list support
Dec 26, 2018
6941a64
Few more list tests
Dec 27, 2018
d2b22f8
Basic iterators
Dec 27, 2018
f65af0d
Support __iter__
Dec 27, 2018
051d422
Iterators
Dec 27, 2018
013b8f5
Fix couple of tests
Dec 28, 2018
fb5a3a5
Add decorator test
Dec 28, 2018
e4b02ad
Generics, part I
Dec 29, 2018
bd5948e
Generics, part 2
Dec 29, 2018
18a7021
Generics, part 3
Dec 30, 2018
2d0223c
Basic TypeVar test
Dec 30, 2018
9415e03
Typings, part 4
Dec 31, 2018
18565ec
Fix test
Dec 31, 2018
0083480
Generics, part 6
Dec 31, 2018
9a096de
Generics, part 7
Jan 1, 2019
534deca
More tests (failing)
Jan 2, 2019
adc81a8
Forward ref fixes
Jan 4, 2019
33d9f8e
Reorg
Jan 4, 2019
8688486
Improve symbol resolution + test fixes
Jan 5, 2019
d44790d
Test fixes
Jan 5, 2019
0678d18
Dictionary, part I
Jan 7, 2019
b83cbe0
Part 11
Jan 8, 2019
11eb84f
Fix test
Jan 8, 2019
4992fbc
Tests
Jan 8, 2019
4e38f55
Tests
Jan 8, 2019
d925a8b
More dict work
Jan 8, 2019
1223b58
List ctor
Jan 8, 2019
16b0788
Skip some tests for now
Jan 8, 2019
ab2f494
Fix iterators
Jan 9, 2019
d595653
Tuple slicing
Jan 9, 2019
549eb9c
Polish type comparo in return types
Jan 9, 2019
25152cd
Add Mapping and tests
Jan 9, 2019
141ef2b
Add Iterable
Jan 9, 2019
0cb9925
Fix typo
Jan 9, 2019
63d6669
Add Iterator[T] + test
Jan 9, 2019
dd1efa5
Simplify typing types
Jan 10, 2019
3a8bf43
Class reduction
Jan 10, 2019
eeddb85
Fix tests
Jan 10, 2019
11be2ea
Test fix
Jan 11, 2019
aeac9e1
Handle 'with' statement
Jan 11, 2019
2c9a0f6
Handle try-except
Jan 11, 2019
9f412a8
Class method inheritance + NewType
Jan 12, 2019
2c8583c
Container types
Jan 12, 2019
828e476
Containers test
Jan 12, 2019
8bbad5f
Tests
Jan 12, 2019
43dec18
Handle generic type alias
Jan 12, 2019
3603e12
Named tuple
Jan 12, 2019
449a36b
Global/non-local
Jan 12, 2019
4455a4c
Handle tuples in for
Jan 13, 2019
eeb6859
Basic generator
Jan 13, 2019
099c551
Any/AnyStr
Jan 13, 2019
dce9a26
Test fixes
Jan 13, 2019
a946ca5
Type/Optional/etc handling
Jan 14, 2019
4b7639a
Proper doc population
Jan 14, 2019
df69a4a
Tests + range
Jan 14, 2019
04eb76f
Argument match
Jan 15, 2019
cc05729
Basic argset and diagnostics
Jan 15, 2019
bef6ac7
Argset tests
Jan 15, 2019
f915b11
Exclude WIP
Jan 15, 2019
a6930c3
Exclude WIP
Jan 15, 2019
d021f5a
Arg eval
Jan 15, 2019
acad306
Arg match, part 2
Jan 16, 2019
c5d2492
Tests and generic arg comparisons
Jan 17, 2019
12f3b6e
Function eval with arguments
Jan 17, 2019
1836cb3
Baselines
Jan 17, 2019
89ba050
Fix test
Jan 17, 2019
7aa1228
Undo AST formatting change and update baseline
Jan 17, 2019
2489857
Fix list ctor argument unpacking
Jan 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 2 additions & 10 deletions build/Common.Build.Core.settings
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,10 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSTarget Condition="$(VSTarget)=='' and '$(VisualStudioVersion)'=='16.0'">16.0</VSTarget>
<VSTarget Condition="$(VSTarget)=='' and '$(VisualStudioVersion)'=='15.0'">15.0</VSTarget>
<VSTarget Condition="$(VSTarget)=='' and '$(VisualStudioVersion)'=='14.0'">14.0</VSTarget>
<VSTarget Condition="$(VSTarget)=='' and '$(VisualStudioVersion)'=='12.0'">12.0</VSTarget>
<VSTarget Condition="$(VSTarget)=='' and '$(VisualStudioVersion)'=='11.0'">11.0</VSTarget>
<VSTarget Condition="$(VSTarget)==''">10.0</VSTarget>


<VSTargetName Condition="'$(VSTarget)' == '16.0'">2019</VSTargetName>
<VSTargetName Condition="'$(VSTarget)' == '15.0'">2017</VSTargetName>
<VSTargetName Condition="'$(VSTarget)' == '14.0'">2015</VSTargetName>
<VSTargetName Condition="'$(VSTarget)' == '12.0'">2013</VSTargetName>
<VSTargetName Condition="'$(VSTarget)' == '11.0'">2012</VSTargetName>
<VSTargetName Condition="'$(VSTarget)' == '10.0'">2010</VSTargetName>


<BuildNumber Condition="'$(BuildNumber)' == ''">$(BUILD_BUILDNUMBER)</BuildNumber>
<BuildNumber Condition="'$(BuildNumber)' == ''">1000.00</BuildNumber>
<!--
Expand Down
113 changes: 113 additions & 0 deletions src/Analysis/Ast/Impl/Analyzer/AnalysisWalker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Python.Analysis.Analyzer.Evaluation;
using Microsoft.Python.Analysis.Analyzer.Handlers;
using Microsoft.Python.Analysis.Analyzer.Symbols;
using Microsoft.Python.Analysis.Types;
using Microsoft.Python.Core;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.Python.Analysis.Analyzer {
/// <summary>
/// Base class with common functionality to module and function analysis walkers.
/// </summary>
internal abstract class AnalysisWalker : PythonWalkerAsync {
protected ImportHandler ImportHandler { get; }
protected FromImportHandler FromImportHandler { get; }
protected LoopHandler LoopHandler { get; }
protected ConditionalHandler ConditionalHandler { get; }
protected AssignmentHandler AssignmentHandler { get; }
protected WithHandler WithHandler { get; }
protected TryExceptHandler TryExceptHandler { get; }
protected NonLocalHandler NonLocalHandler { get; }

public ExpressionEval Eval { get; }
public IPythonModule Module => Eval.Module;
public IPythonInterpreter Interpreter => Eval.Interpreter;
public PythonAst Ast => Eval.Ast;
protected ModuleSymbolTable SymbolTable => Eval.SymbolTable;

protected AnalysisWalker(ExpressionEval eval) {
Eval = eval;
ImportHandler = new ImportHandler(this);
FromImportHandler = new FromImportHandler(this);
AssignmentHandler = new AssignmentHandler(this);
LoopHandler = new LoopHandler(this);
ConditionalHandler = new ConditionalHandler(this);
WithHandler = new WithHandler(this);
TryExceptHandler = new TryExceptHandler(this);
NonLocalHandler = new NonLocalHandler(this);
}

protected AnalysisWalker(IServiceContainer services, IPythonModule module, PythonAst ast)
: this(new ExpressionEval(services, module, ast)) {
}

#region AST walker overrides
public override async Task<bool> WalkAsync(AssignmentStatement node, CancellationToken cancellationToken = default) {
await AssignmentHandler.HandleAssignmentAsync(node, cancellationToken);
return await base.WalkAsync(node, cancellationToken);
}

public override async Task<bool> WalkAsync(ExpressionStatement node, CancellationToken cancellationToken = default) {
await AssignmentHandler.HandleAnnotatedExpressionAsync(node.Expression as ExpressionWithAnnotation, null, cancellationToken);
return false;
}

public override async Task<bool> WalkAsync(ForStatement node, CancellationToken cancellationToken = default) {
await LoopHandler.HandleForAsync(node, cancellationToken);
return await base.WalkAsync(node, cancellationToken);
}

public override Task<bool> WalkAsync(FromImportStatement node, CancellationToken cancellationToken = default)
=> FromImportHandler.HandleFromImportAsync(node, cancellationToken);

public override Task<bool> WalkAsync(GlobalStatement node, CancellationToken cancellationToken = default)
=> NonLocalHandler.HandleGlobalAsync(node, cancellationToken);

public override Task<bool> WalkAsync(IfStatement node, CancellationToken cancellationToken = default)
=> ConditionalHandler.HandleIfAsync(node, cancellationToken);

public override Task<bool> WalkAsync(ImportStatement node, CancellationToken cancellationToken = default)
=> ImportHandler.HandleImportAsync(node, cancellationToken);

public override Task<bool> WalkAsync(NonlocalStatement node, CancellationToken cancellationToken = default)
=> NonLocalHandler.HandleNonLocalAsync(node, cancellationToken);

public override async Task<bool> WalkAsync(TryStatement node, CancellationToken cancellationToken = default) {
await TryExceptHandler.HandleTryExceptAsync(node, cancellationToken);
return await base.WalkAsync(node, cancellationToken);
}

public override async Task<bool> WalkAsync(WhileStatement node, CancellationToken cancellationToken = default) {
await LoopHandler.HandleWhileAsync(node, cancellationToken);
return await base.WalkAsync(node, cancellationToken);
}

public override async Task<bool> WalkAsync(WithStatement node, CancellationToken cancellationToken = default) {
await WithHandler.HandleWithAsync(node, cancellationToken);
return await base.WalkAsync(node, cancellationToken);
}
#endregion

protected T[] GetStatements<T>(ScopeStatement s)
=> (s.Body as SuiteStatement)?.Statements.OfType<T>().ToArray() ?? Array.Empty<T>();
}
}
47 changes: 47 additions & 0 deletions src/Analysis/Ast/Impl/Analyzer/Definitions/IAnalyzable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

namespace Microsoft.Python.Analysis.Analyzer {
/// <summary>
/// Represents document that can be analyzed asynchronously.
/// </summary>
internal interface IAnalyzable {
/// <summary>
/// Expected version of the analysis when asynchronous operations complete.
/// Typically every change to the document or documents that depend on it
/// increment the expected version. At the end of the analysis if the expected
/// version is still the same, the analysis is applied to the document and
/// becomes available to consumers.
/// </summary>
int ExpectedAnalysisVersion { get; }

/// <summary>
/// Notifies document that analysis is now pending. Typically document increments
/// the expected analysis version. The method can be called repeatedly without
/// calling `CompleteAnalysis` first. The method is invoked for every dependency
/// in the chain to ensure that objects know that their dependencies have been
/// modified and the current analysis is no longer up to date.
/// </summary>
void NotifyAnalysisPending();

/// <summary>
/// Notifies document that its analysis is now complete.
/// </summary>
/// <param name="analysis">Document analysis</param>
/// (version of the snapshot in the beginning of analysis).</param>
/// <returns>True if analysis was accepted, false if is is out of date.</returns>
bool NotifyAnalysisComplete(IDocumentAnalysis analysis);
}
}
32 changes: 32 additions & 0 deletions src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using System.Threading;
using System.Threading.Tasks;
using Microsoft.Python.Analysis.Documents;

namespace Microsoft.Python.Analysis.Analyzer {
public interface IPythonAnalyzer {
/// <summary>
/// Analyze single document.
/// </summary>
Task AnalyzeDocumentAsync(IDocument document, CancellationToken cancellationToken);

/// <summary>
/// Analyze document with dependents.
/// </summary>
Task AnalyzeDocumentDependencyChainAsync(IDocument document, CancellationToken cancellationToken);
}
}
99 changes: 99 additions & 0 deletions src/Analysis/Ast/Impl/Analyzer/DocumentAnalysis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using System.Collections.Generic;
using System.Linq;
using Microsoft.Python.Analysis.Diagnostics;
using Microsoft.Python.Analysis.Types;
using Microsoft.Python.Analysis.Documents;
using Microsoft.Python.Analysis.Values;
using Microsoft.Python.Core;
using Microsoft.Python.Core.Diagnostics;
using Microsoft.Python.Core.Text;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.Python.Analysis.Analyzer {
internal sealed class DocumentAnalysis : IDocumentAnalysis {
public static readonly IDocumentAnalysis Empty = new EmptyAnalysis();

public DocumentAnalysis(IDocument document, int version, IGlobalScope globalScope, PythonAst ast) {
Check.ArgumentNotNull(nameof(document), document);
Check.ArgumentNotNull(nameof(globalScope), globalScope);
Document = document;
Version = version;
GlobalScope = globalScope;
Ast = ast;
}

#region IDocumentAnalysis
/// <summary>
/// Analyzed document.
/// </summary>
public IDocument Document { get; }

/// <summary>
/// Version of the analysis. Usually matches document version,
/// but can be lower when document or its dependencies were
/// updated since.
/// </summary>
public int Version { get; }

/// <summary>
/// AST that was used in the analysis.
/// </summary>
public PythonAst Ast { get; }

/// <summary>
/// Document/module global scope.
/// </summary>
public IGlobalScope GlobalScope { get; }

/// <summary>
/// Module top-level members
/// </summary>
public IVariableCollection TopLevelVariables => GlobalScope.Variables;

/// <summary>
/// All module members from all scopes.
/// </summary>
public IEnumerable<IVariable> AllVariables
=> (GlobalScope as IScope).TraverseBreadthFirst(s => s.Children).SelectMany(s => s.Variables);

public IEnumerable<IPythonType> GetAllAvailableItems(SourceLocation location) => Enumerable.Empty<IPythonType>();
public IEnumerable<IPythonType> GetMembers(SourceLocation location) => Enumerable.Empty<IPythonType>();
public IEnumerable<IPythonFunctionOverload> GetSignatures(SourceLocation location) => Enumerable.Empty<IPythonFunctionOverload>();
public IEnumerable<IPythonType> GetValues(SourceLocation location) => Enumerable.Empty<IPythonType>();
#endregion

private sealed class EmptyAnalysis : IDocumentAnalysis {
public EmptyAnalysis(IDocument document = null) {
Document = document;
GlobalScope = new EmptyGlobalScope(document);
}

public IDocument Document { get; }
public int Version { get; } = -1;
public IGlobalScope GlobalScope { get; }
public PythonAst Ast => null;
public IEnumerable<IPythonType> GetAllAvailableItems(SourceLocation location) => Enumerable.Empty<IPythonType>();
public IEnumerable<DiagnosticsEntry> Diagnostics => Enumerable.Empty<DiagnosticsEntry>();
public IVariableCollection TopLevelVariables => VariableCollection.Empty;
public IEnumerable<IVariable> AllVariables => Enumerable.Empty<IVariable>();
public IEnumerable<IPythonType> GetMembers(SourceLocation location) => Enumerable.Empty<IPythonType>();
public IEnumerable<IPythonFunctionOverload> GetSignatures(SourceLocation location) => Enumerable.Empty<IPythonFunctionOverload>();
public IEnumerable<IPythonType> GetValues(SourceLocation location) => Enumerable.Empty<IPythonType>();
}
}
}
Loading