comparison src/vim9compile.c @ 19860:37c4779ca8f5 v8.2.0486

patch 8.2.0486: Vim9: some code and error messages not tested Commit: https://github.com/vim/vim/commit/9be61bbb170ed3df0e408c8ac12516e772dc0b75 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 30 22:51:24 2020 +0200 patch 8.2.0486: Vim9: some code and error messages not tested Problem: Vim9: some code and error messages not tested. Solution: Add more tests.
author Bram Moolenaar <Bram@vim.org>
date Mon, 30 Mar 2020 23:00:05 +0200
parents cf09c0962608
children 846fbbacce3a
comparison
equal deleted inserted replaced
19859:904b25746b64 19860:37c4779ca8f5
3351 == FAIL) 3351 == FAIL)
3352 return NULL; 3352 return NULL;
3353 } 3353 }
3354 else 3354 else
3355 { 3355 {
3356 if (set_return_type) 3356 // "set_return_type" cannot be TRUE, only used for a lambda which
3357 cctx->ctx_ufunc->uf_ret_type = &t_void; 3357 // always has an argument.
3358 else if (cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_VOID) 3358 if (cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_VOID)
3359 { 3359 {
3360 emsg(_("E1003: Missing return value")); 3360 emsg(_("E1003: Missing return value"));
3361 return NULL; 3361 return NULL;
3362 } 3362 }
3363 3363
3414 int do_concat UNUSED) 3414 int do_concat UNUSED)
3415 { 3415 {
3416 cctx_T *cctx = (cctx_T *)cookie; 3416 cctx_T *cctx = (cctx_T *)cookie;
3417 3417
3418 if (cctx->ctx_lnum == cctx->ctx_ufunc->uf_lines.ga_len) 3418 if (cctx->ctx_lnum == cctx->ctx_ufunc->uf_lines.ga_len)
3419 NULL; 3419 {
3420 iemsg("Heredoc got to end");
3421 return NULL;
3422 }
3420 ++cctx->ctx_lnum; 3423 ++cctx->ctx_lnum;
3421 return vim_strsave(((char_u **)cctx->ctx_ufunc->uf_lines.ga_data) 3424 return vim_strsave(((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)
3422 [cctx->ctx_lnum]); 3425 [cctx->ctx_lnum]);
3423 } 3426 }
3424 3427
3470 // TODO: let [var, var] = list 3473 // TODO: let [var, var] = list
3471 emsg("Cannot handle a list yet"); 3474 emsg("Cannot handle a list yet");
3472 return NULL; 3475 return NULL;
3473 } 3476 }
3474 3477
3478 // "a: type" is declaring variable "a" with a type, not "a:".
3479 if (is_decl && p == arg + 2 && p[-1] == ':')
3480 --p;
3481
3475 varlen = p - arg; 3482 varlen = p - arg;
3476 name = vim_strnsave(arg, (int)varlen); 3483 name = vim_strnsave(arg, (int)varlen);
3477 if (name == NULL) 3484 if (name == NULL)
3478 return NULL; 3485 return NULL;
3479 3486
3497 } 3504 }
3498 p = arg; 3505 p = arg;
3499 p = find_option_end(&p, &opt_flags); 3506 p = find_option_end(&p, &opt_flags);
3500 if (p == NULL) 3507 if (p == NULL)
3501 { 3508 {
3509 // cannot happen?
3502 emsg(_(e_letunexp)); 3510 emsg(_(e_letunexp));
3503 return NULL; 3511 return NULL;
3504 } 3512 }
3505 cc = *p; 3513 cc = *p;
3506 *p = NUL; 3514 *p = NUL;
3507 opt_type = get_option_value(arg + 1, &numval, NULL, opt_flags); 3515 opt_type = get_option_value(arg + 1, &numval, NULL, opt_flags);
3508 *p = cc; 3516 *p = cc;
3509 if (opt_type == -3) 3517 if (opt_type == -3)
3510 { 3518 {
3511 semsg(_(e_unknown_option), *arg); 3519 semsg(_(e_unknown_option), arg);
3512 return NULL; 3520 return NULL;
3513 } 3521 }
3514 if (opt_type == -2 || opt_type == 0) 3522 if (opt_type == -2 || opt_type == 0)
3515 type = &t_string; 3523 type = &t_string;
3516 else 3524 else