1
0
forked from VimPlug/jedi

static analysis prototype decription

This commit is contained in:
Dave Halter
2014-05-07 12:39:18 +02:00
parent 895db8d6ff
commit 9eb75f9c61
2 changed files with 44 additions and 0 deletions

View File

@@ -92,6 +92,7 @@ class Evaluator(object):
self.compiled_cache = {} # see `compiled.create()`
self.recursion_detector = recursion.RecursionDetector()
self.execution_recursion_detector = recursion.ExecutionRecursionDetector()
self.analysis = []
def find_types(self, scope, name_str, position=None, search_global=False,
is_goto=False, resolve_decorator=True):

43
jedi/evaluate/analysis.py Normal file
View File

@@ -0,0 +1,43 @@
"""
Module for statical analysis.
"""
from jedi import debug
CODES = {
'inaccesible': (1, 'Attribute is not accessible.'),
}
class Error(object):
def __init__(self, name, start_pos):
self._start_pos = start_pos
self.name = name
@property
def line(self):
return self._start_pos[0]
@property
def column(self):
return self._start_pos[1]
@property
def code(self):
# The class name start
first = self.__class__.__name__[0]
return first + str(CODES[self.name][0])
def __str__(self):
return '%s: %s' % (self.code, self.line)
class Warning(Error):
pass
def add(evaluator, code, typ=Error):
instance = typ()
debug.warning(str(Error))
evaluator.analysis.append(instance)