mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 07:41:51 +08:00
fix a little error that caused the completion not to work with if/try statements
This commit is contained in:
@@ -1370,9 +1370,14 @@ class PyFuzzyParser(object):
|
|||||||
# the last statement has to be another part of
|
# the last statement has to be another part of
|
||||||
# the flow statement, because a dedent releases the
|
# the flow statement, because a dedent releases the
|
||||||
# main scope, so just take the last statement.
|
# main scope, so just take the last statement.
|
||||||
self.scope = self.scope.statements[-1].set_next(f)
|
try:
|
||||||
|
s = self.scope.statements[-1].set_next(f)
|
||||||
|
except AttributeError:
|
||||||
|
# If set_next doesn't exist, just add it.
|
||||||
|
s = self.scope.add_statement(f)
|
||||||
else:
|
else:
|
||||||
self.scope = self.scope.add_statement(f)
|
s = self.scope.add_statement(f)
|
||||||
|
self.scope = s
|
||||||
else:
|
else:
|
||||||
debug.warning('syntax err, flow started @%s',
|
debug.warning('syntax err, flow started @%s',
|
||||||
self.line_nr)
|
self.line_nr)
|
||||||
|
|||||||
@@ -27,3 +27,19 @@ def normalfunc():
|
|||||||
|
|
||||||
##? ['real']
|
##? ['real']
|
||||||
normalfunc().real
|
normalfunc().real
|
||||||
|
|
||||||
|
|
||||||
|
# first part not complete (raised errors)
|
||||||
|
if a
|
||||||
|
a
|
||||||
|
else:
|
||||||
|
#? ['AttributeError']
|
||||||
|
AttributeError
|
||||||
|
|
||||||
|
try
|
||||||
|
#? ['AttributeError']
|
||||||
|
except AttributeError
|
||||||
|
pass
|
||||||
|
finally:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user