1
0
forked from VimPlug/jedi

The parser_cache contents have changed. Therefore adapt.

This commit is contained in:
Dave Halter
2017-05-26 12:52:52 -04:00
parent 35e248091e
commit 76529ca34d
2 changed files with 4 additions and 3 deletions

View File

@@ -389,7 +389,7 @@ class BaseDefinition(object):
return '' return ''
path = self._name.get_root_context().py__file__() path = self._name.get_root_context().py__file__()
lines = parser_cache[path].lines lines = parser_cache[self._evaluator.grammar._hashed][path].lines
line_nr = self._name.start_pos[0] line_nr = self._name.start_pos[0]
start_line_nr = line_nr - before start_line_nr = line_nr - before

View File

@@ -13,9 +13,10 @@ from parso import cache
def test_preload_modules(): def test_preload_modules():
def check_loaded(*modules): def check_loaded(*modules):
# +1 for None module (currently used) # +1 for None module (currently used)
assert len(parser_cache) == len(modules) + 1 grammar_cache = next(iter(parser_cache.values()))
assert len(grammar_cache) == len(modules) + 1
for i in modules: for i in modules:
assert [i in k for k in parser_cache.keys() if k is not None] assert [i in k for k in grammar_cache.keys() if k is not None]
temp_cache, cache.parser_cache = cache.parser_cache, {} temp_cache, cache.parser_cache = cache.parser_cache, {}
parser_cache = cache.parser_cache parser_cache = cache.parser_cache