comparison src/vim9cmds.c @ 31317:8481d84f7929 v9.0.0992

patch 9.0.0992: Vim9 script: get E1096 when comment follows return Commit: https://github.com/vim/vim/commit/500c4442834363e02541da564f0b87b82d5783cd Author: mityu <mityu.mail@gmail.com> Date: Fri Dec 2 18:12:05 2022 +0000 patch 9.0.0992: Vim9 script: get E1096 when comment follows return Problem: Vim9 script: get E1096 when comment follows return. Solution: Adjust condition for return without expression. (closes https://github.com/vim/vim/issues/11654)
author Bram Moolenaar <Bram@vim.org>
date Fri, 02 Dec 2022 19:15:03 +0100
parents 360f286b5869
children 1bebc2093e6b
comparison
equal deleted inserted replaced
31316:646b2a1e9716 31317:8481d84f7929
2529 compile_return(char_u *arg, int check_return_type, int legacy, cctx_T *cctx) 2529 compile_return(char_u *arg, int check_return_type, int legacy, cctx_T *cctx)
2530 { 2530 {
2531 char_u *p = arg; 2531 char_u *p = arg;
2532 type_T *stack_type; 2532 type_T *stack_type;
2533 2533
2534 if (*p != NUL && *p != '|' && *p != '\n') 2534 if (*p != NUL && *p != '|' && *p != '\n'
2535 && (legacy || !vim9_comment_start(p)))
2535 { 2536 {
2536 // For a lambda, "return expr" is always used, also when "expr" results 2537 // For a lambda, "return expr" is always used, also when "expr" results
2537 // in a void. 2538 // in a void.
2538 if (cctx->ctx_ufunc->uf_ret_type->tt_type == VAR_VOID 2539 if (cctx->ctx_ufunc->uf_ret_type->tt_type == VAR_VOID
2539 && (cctx->ctx_ufunc->uf_flags & FC_LAMBDA) == 0) 2540 && (cctx->ctx_ufunc->uf_flags & FC_LAMBDA) == 0)