summaryrefslogtreecommitdiff
path: root/src/vim9cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vim9cmds.c')
-rw-r--r--src/vim9cmds.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vim9cmds.c b/src/vim9cmds.c
index 06964d52f..ecf31dca5 100644
--- a/src/vim9cmds.c
+++ b/src/vim9cmds.c
@@ -2531,7 +2531,8 @@ compile_return(char_u *arg, int check_return_type, int legacy, cctx_T *cctx)
char_u *p = arg;
type_T *stack_type;
- if (*p != NUL && *p != '|' && *p != '\n')
+ if (*p != NUL && *p != '|' && *p != '\n'
+ && (legacy || !vim9_comment_start(p)))
{
// For a lambda, "return expr" is always used, also when "expr" results
// in a void.