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

[WIP]: Split analysis into several assemblies #441

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/AnalysisExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// permissions and limitations under the License.

using System;
using Microsoft.PythonTools.Parsing;
using Microsoft.Python.Parsing;

namespace Microsoft.PythonTools.Interpreter {
public static class AnalysisExtensions {
Expand Down
5 changes: 3 additions & 2 deletions src/Analysis/Engine/Impl/AnalysisLogWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 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,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
Expand All @@ -22,7 +22,8 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.PythonTools.Analysis.Infrastructure;
using Microsoft.Python.Core;
using Microsoft.Python.Core.IO;

namespace Microsoft.PythonTools.Analysis {
public class AnalysisLogWriter : IDisposable {
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Engine/Impl/AnalysisSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 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,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
Expand All @@ -18,7 +18,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.PythonTools.Analysis.Infrastructure;
using Microsoft.Python.Core;

namespace Microsoft.PythonTools.Analysis {
/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/Analysis/Engine/Impl/AnalysisUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 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,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
Expand All @@ -19,12 +19,12 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Microsoft.Python.Core;
using Microsoft.PythonTools.Analysis.Analyzer;
using Microsoft.PythonTools.Analysis.Infrastructure;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Parsing;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis {
/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Engine/Impl/AnalysisValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
using Microsoft.PythonTools.Analysis.Analyzer;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Parsing;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis {
/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/Analysis/Engine/Impl/AnalysisValueSetExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
using System.Linq;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Parsing;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis {
/// <summary>
Expand Down Expand Up @@ -218,7 +218,7 @@ internal static AnalysisValue GetUnionType(this IAnalysisSet types) {
/// Gets instance representations of all members of the set.
/// </summary>
public static IAnalysisSet GetInstanceType(this IAnalysisSet types)
=> AnalysisSet.Create(types.SelectMany(ns => (ns.PythonType as IPythonType2)?.IsClass == true ? ns : ns.GetInstanceType()));
=> AnalysisSet.Create(types.SelectMany(ns => ns.PythonType?.IsTypeFactory == true ? ns : ns.GetInstanceType()));

public static bool IsUnknown(this IAnalysisSet res) {
return res == null ||
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Analyzer/ClassScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// permissions and limitations under the License.

using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
sealed class ClassScope : InterpreterScope, IClassScope {
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Analyzer/ComprehensionScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
sealed class ComprehensionScope : InterpreterScope {
Expand Down
9 changes: 5 additions & 4 deletions src/Analysis/Engine/Impl/Analyzer/DDG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 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,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
Expand All @@ -19,9 +19,10 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Microsoft.PythonTools.Analysis.Infrastructure;
using Microsoft.Python.Core;
using Microsoft.Python.Core.Interpreter;
using Microsoft.Python.Parsing.Ast;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
internal class DDG : PythonWalker {
Expand Down Expand Up @@ -512,7 +513,7 @@ internal void WalkBody(Node node, AnalysisUnit unit) {
}

public override bool Walk(IfStatement node) {
foreach (var test in node.TestsInternal) {
foreach (var test in node.Tests) {
_eval.Evaluate(test.Test);

var prevScope = Scope;
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Engine/Impl/Analyzer/ErrorMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
// 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,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using Microsoft.PythonTools.Analysis.Infrastructure;
using Microsoft.Python.Core;

namespace Microsoft.PythonTools.Analysis.Analyzer {
static class ErrorMessages {
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Engine/Impl/Analyzer/ExpressionEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
using System.Linq;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Parsing;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
internal class ExpressionEvaluator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
class ExpressionEvaluatorAnnotationConverter : TypeAnnotationConverter<IAnalysisSet> {
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Engine/Impl/Analyzer/FunctionAnalysisUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.PythonTools.Analysis.Infrastructure;
using Microsoft.Python.Core;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
class FunctionAnalysisUnit : AnalysisUnit {
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Analyzer/FunctionScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using System.Diagnostics;
using System.Linq;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
sealed class FunctionScope : InterpreterScope, IFunctionScope {
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Analyzer/ImportSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// permissions and limitations under the License.

using System;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
public interface IImportSource {
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Analyzer/ImportStatementWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System.Collections.Generic;
using System.Linq;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
internal class ImportStatementWalker : PythonWalker {
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Analyzer/InterpreterScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
abstract class InterpreterScope: IScope {
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Analyzer/IsInstanceScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
sealed class IsInstanceScope : InterpreterScope {
Expand Down
5 changes: 3 additions & 2 deletions src/Analysis/Engine/Impl/Analyzer/ModuleScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
// 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,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using Microsoft.Python.Parsing.Ast;
using Microsoft.PythonTools.Analysis.Values;

namespace Microsoft.PythonTools.Analysis.Analyzer {
Expand All @@ -34,7 +35,7 @@ internal void SetModuleVariable(string name, IAnalysisSet value)

public override string Name => Module.Name;

public override bool AssignVariable(string name, Parsing.Ast.Node location, AnalysisUnit unit, IAnalysisSet values) {
public override bool AssignVariable(string name, Node location, AnalysisUnit unit, IAnalysisSet values) {
if (base.AssignVariable(name, location, unit, values)) {
Module.ModuleDefinition.EnqueueDependents();
return true;
Expand Down
14 changes: 8 additions & 6 deletions src/Analysis/Engine/Impl/Analyzer/OverviewWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
using System.Diagnostics;
using System.Linq;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Parsing;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
/// <summary>
Expand Down Expand Up @@ -453,8 +453,8 @@ public override bool Walk(FromImportStatement node) {

public override bool Walk(IfStatement node) {
UpdateChildRanges(node);
if (node.TestsInternal != null) {
foreach (var test in node.TestsInternal) {
if (node.Tests != null) {
foreach (var test in node.Tests) {
var isInstanceNames = GetIsInstanceNamesAndExpressions(test.Test);
if (isInstanceNames != null) {
if (test.Test != null) {
Expand Down Expand Up @@ -558,11 +558,13 @@ public override bool Walk(SuiteStatement node) {
var lineNo = _tree.IndexToLocation(node.EndIndex).Line;

int offset;
if (_tree._lineLocations.Length == 0) {
if (_tree.NewLineLocations.Length == 0) {
// single line input
offset = 0;
} else {
offset = lineNo < _tree._lineLocations.Length ? _tree._lineLocations[lineNo].EndIndex : _tree._lineLocations[_tree._lineLocations.Length - 1].EndIndex;
offset = lineNo < _tree.NewLineLocations.Length
? _tree.NewLineLocations[lineNo].EndIndex
: _tree.NewLineLocations[_tree.NewLineLocations.Length - 1].EndIndex;
}
var closingScope = new StatementScope(offset, _scope);
_scope.Children.Add(closingScope);
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Analyzer/StatementScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis.Analyzer {
class StatementScope : InterpreterScope {
Expand Down
4 changes: 2 additions & 2 deletions src/Analysis/Engine/Impl/Definitions/Diagnostic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
// 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,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using System;
using Microsoft.Python.Core.Text;

namespace Microsoft.PythonTools.Analysis {
public class Diagnostic {
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Definitions/IAnalysisCookie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis {
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Definitions/IAnalysisUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis {
public interface IAnalysisUnit : ILocationResolver, ICanExpire {
Expand Down
1 change: 1 addition & 0 deletions src/Analysis/Engine/Impl/Definitions/ILocationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// permissions and limitations under the License.

using System;
using Microsoft.Python.Core.Text;

namespace Microsoft.PythonTools.Analysis {
public interface ILocationInfo: IEquatable<ILocationInfo>, ILocationResolver {
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis/Engine/Impl/Definitions/IModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using System.Collections.Generic;
using Microsoft.PythonTools.Analysis.Values;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Parsing.Ast;
using Microsoft.Python.Parsing.Ast;

namespace Microsoft.PythonTools.Analysis {
public interface IModule : IAnalysisValue {
Expand Down
Loading