Skip to content

Commit

Permalink
Ignore syntax error when parsing AST for goto locations
Browse files Browse the repository at this point in the history
  • Loading branch information
numirias committed Sep 15, 2019
1 parent 741916c commit ca6b2c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rplugin/python3/semshi/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,11 @@ def locations_by_node_types(self, types):
except KeyError:
pass
visitor = _LocationCollectionVisitor(types)
visitor.visit(ast.parse(lines_to_code(self.lines)))
try:
ast_ = ast.parse(lines_to_code(self.lines))
except SyntaxError:
return []
visitor.visit(ast_)
locations = visitor.locations
self._locations[types_set] = locations
return locations
Expand Down

0 comments on commit ca6b2c1

Please sign in to comment.