void (final @NotNull PyReturnStatement node) { final PyFunction function = PsiTreeUtil.getParentOfType(node, PyFunction.class, false, PyClass.class); if (function == null) { getHolder().newAnnotation(HighlightSeverity.ERROR, PyPsiBundle.message("ANN.return.outside.of.function")).create(); } if (function != null && node.getExpression() != null && function.isGenerator() && (function.isAsync() && function.isAsyncAllowed())) { getHolder().newAnnotation(HighlightSeverity.ERROR, PyPsiBundle.message("ANN.non.empty.return.inside.asynchronous.generator")).create(); } }