await checks.

This commit is contained in:
Dave Halter
2017-07-20 09:44:10 +02:00
parent 7c9877cd2e
commit fc1c16b966
3 changed files with 29 additions and 1 deletions

View File

@@ -128,6 +128,10 @@ class ErrorFinder(Normalizer):
elif leaf.value == 'return':
if self._context.node.type != 'funcdef':
self._add_syntax_error("'return' outside function", leaf)
elif leaf.value == 'await':
if self._context.node.type != 'funcdef' \
or self._context.node.parent.type != 'async_funcdef':
self._add_syntax_error("'await' outside async function", leaf)
return ''
def _add_indentation_error(self, message, spacing):