1
0
forked from VimPlug/jedi

variables starting with 'class' and 'def' should not slow down the parser, changed the check to 'class ' and 'def '.

This commit is contained in:
Dave Halter
2015-02-16 10:07:41 +01:00
parent 3680784234
commit e1c28d2c3f
2 changed files with 12 additions and 1 deletions

View File

@@ -221,7 +221,7 @@ class ParserNode(object):
class FastParser(use_metaclass(CachedFastParser)):
_keyword_re = re.compile('^[ \t]*(def|class|@|%s)' % '|'.join(FLOWS))
_keyword_re = re.compile('^[ \t]*(def |class |@|%s)' % '|'.join(FLOWS))
def __init__(self, grammar, source, module_path=None):
# set values like `pr.Module`.

View File

@@ -163,6 +163,17 @@ def test_for():
check_fp(src, 1)
def test_class_with_class_var():
src = dedent("""\
class SuperClass:
class_super = 3
def __init__(self):
self.foo = 4
pass
""")
check_fp(src, 3)
def test_func_with_if():
src = dedent("""\
def recursion(a):