fix a little error that caused the completion not to work with if/try statements

This commit is contained in:
David Halter
2012-06-24 20:19:19 +02:00
parent 77698599f4
commit cffa236fc2
2 changed files with 23 additions and 2 deletions

View File

@@ -1370,9 +1370,14 @@ class PyFuzzyParser(object):
# the last statement has to be another part of
# the flow statement, because a dedent releases the
# 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:
self.scope = self.scope.add_statement(f)
s = self.scope.add_statement(f)
self.scope = s
else:
debug.warning('syntax err, flow started @%s',
self.line_nr)