Reenable call signature caching and move a lot of parser specific caching to the parser itself.

This commit is contained in:
Dave Halter
2016-06-28 08:46:29 +02:00
parent 746a513ef9
commit 52c42c3392
10 changed files with 65 additions and 251 deletions
+4 -4
View File
@@ -10,7 +10,7 @@ from jedi._compatibility import use_metaclass
from jedi import settings
from jedi.parser import ParserWithRecovery
from jedi.parser import tree
from jedi import cache
from jedi.parser.utils import underscore_memoization, parser_cache
from jedi import debug
from jedi.parser.tokenize import (source_tokens, NEWLINE,
ENDMARKER, INDENT, DEDENT)
@@ -36,7 +36,7 @@ class FastModule(tree.Module):
pass # It was never used.
@property
@cache.underscore_memoization
@underscore_memoization
def used_names(self):
return MergedNamesDict([m.used_names for m in self.modules])
@@ -102,7 +102,7 @@ class CachedFastParser(type):
if not settings.fast_parser:
return ParserWithRecovery(grammar, source, module_path)
pi = cache.parser_cache.get(module_path, None)
pi = parser_cache.get(module_path, None)
if pi is None or isinstance(pi.parser, ParserWithRecovery):
p = super(CachedFastParser, self).__call__(grammar, source, module_path)
else:
@@ -236,7 +236,7 @@ class ParserNode(object):
for y in n.all_sub_nodes():
yield y
@cache.underscore_memoization # Should only happen once!
@underscore_memoization # Should only happen once!
def remove_last_newline(self):
self.parser.remove_last_newline()
+2 -2
View File
@@ -41,8 +41,8 @@ import abc
from jedi._compatibility import (Python3Method, encoding, is_py3, utf8_repr,
literal_eval, use_metaclass, unicode)
from jedi import cache
from jedi.parser import token
from jedi.parser.utils import underscore_memoization
def is_node(node, *symbol_names):
@@ -788,7 +788,7 @@ class Module(Scope):
self.path = None # Set later.
@property
@cache.underscore_memoization
@underscore_memoization
def name(self):
""" This is used for the goto functions. """
if self.path is None: