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

Commit 044a70d

Browse files
author
Mikhail Arkhipov
authored
Merge pull request #191 from losttech/features/AbstractFunctions
mark abstract functions as such
2 parents 13448bb + 14ca3e4 commit 044a70d

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Analysis/Engine/Impl/Analyzer/FunctionAnalysisUnit.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,21 @@ private bool ProcessAbstractDecorators(IAnalysisSet decorator) {
109109
switch (d.Name) {
110110
case "abstractmethod":
111111
res = true;
112+
Function.IsAbstract = true;
112113
break;
113114
case "abstractstaticmethod":
114115
Function.IsStatic = true;
116+
Function.IsAbstract = true;
115117
res = true;
116118
break;
117119
case "abstractclassmethod":
118120
Function.IsClassMethod = true;
121+
Function.IsAbstract = true;
119122
res = true;
120123
break;
121124
case "abstractproperty":
122125
Function.IsProperty = true;
126+
Function.IsAbstract = true;
123127
res = true;
124128
break;
125129
}

src/Analysis/Engine/Impl/Values/Definitions/IFunctionInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ public interface IFunctionInfo: IAnalysisValue {
2525
bool IsClosure { get; }
2626
IPythonProjectEntry ProjectEntry { get; }
2727
}
28+
29+
public interface IFunctionInfo2 : IFunctionInfo {
30+
bool IsAbstract { get; }
31+
}
2832
}

src/Analysis/Engine/Impl/Values/FunctionInfo.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
using Microsoft.PythonTools.Parsing.Ast;
2626

2727
namespace Microsoft.PythonTools.Analysis.Values {
28-
internal class FunctionInfo : AnalysisValue, IFunctionInfo, IHasRichDescription, IHasQualifiedName {
28+
internal class FunctionInfo : AnalysisValue, IFunctionInfo2, IHasRichDescription, IHasQualifiedName {
2929
private Dictionary<AnalysisValue, IAnalysisSet> _methods;
3030
private Dictionary<string, VariableDef> _functionAttrs;
3131
private readonly FunctionAnalysisUnit _analysisUnit;
@@ -84,6 +84,7 @@ private static bool CanBeClosure(PythonAnalyzer state, IPythonProjectEntry entry
8484
public bool IsStatic { get; set; }
8585
public bool IsClassMethod { get; set; }
8686
public bool IsProperty { get; set; }
87+
public bool IsAbstract { get; internal set; }
8788
public bool IsClosure => _callsWithClosure != null;
8889

8990
public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {

0 commit comments

Comments
 (0)