1
0
forked from VimPlug/jedi

Start using the correct parser for each environment

This commit is contained in:
Dave Halter
2017-12-19 19:19:35 +01:00
parent a9ebd92c20
commit 96a67f9a4c
5 changed files with 10 additions and 11 deletions

View File

@@ -87,8 +87,13 @@ from jedi.evaluate.syntax_tree import eval_trailer, eval_expr_stmt, \
class Evaluator(object):
def __init__(self, grammar, project, environment=None):
self.grammar = grammar
def __init__(self, project, environment=None):
if environment is None:
environment = get_default_environment()
self.environment = environment
self.compiled_subprocess = environment.get_evaluator_subprocess(self)
self.grammar = environment.get_grammar()
self.latest_grammar = parso.load_grammar(version='3.6')
self.memoize_cache = {} # for memoize decorators
# To memorize modules -> equals `sys.modules`.
@@ -104,11 +109,6 @@ class Evaluator(object):
self.access_cache = {}
project.add_evaluator(self)
if environment is None:
environment = get_default_environment()
self.environment = environment
self.compiled_subprocess = environment.get_evaluator_subprocess(self)
self.reset_recursion_limitations()
@property

View File

@@ -203,7 +203,6 @@ class Listener(object):
except KeyError:
from jedi.api.environment import InterpreterEnvironment
evaluator = Evaluator(
grammar=None,
project=project.Project(),
environment=InterpreterEnvironment()
)