comparison src/vim9compile.c @ 22004:a9e60176dcd3 v8.2.1551

patch 8.2.1551: Vim9: error for argument type does not mention the number Commit: https://github.com/vim/vim/commit/8b565c2c1522e0c41e3d18e1bb6e1bc4b3686842 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 30 23:24:20 2020 +0200 patch 8.2.1551: Vim9: error for argument type does not mention the number Problem: Vim9: error for argument type does not mention the number. Solution: Pass the argument number to where the error is given.
author Bram Moolenaar <Bram@vim.org>
date Sun, 30 Aug 2020 23:30:04 +0200
parents a98211c3e14e
children 514d622473af
comparison
equal deleted inserted replaced
22003:b22488a6de96 22004:a9e60176dcd3
727 type_T *expected, 727 type_T *expected,
728 int offset, 728 int offset,
729 cctx_T *cctx, 729 cctx_T *cctx,
730 int silent) 730 int silent)
731 { 731 {
732 if (check_type(expected, actual, FALSE) == OK) 732 if (check_type(expected, actual, FALSE, 0) == OK)
733 return OK; 733 return OK;
734 if (actual->tt_type != VAR_ANY 734 if (actual->tt_type != VAR_ANY
735 && actual->tt_type != VAR_UNKNOWN 735 && actual->tt_type != VAR_UNKNOWN
736 && !(actual->tt_type == VAR_FUNC 736 && !(actual->tt_type == VAR_FUNC
737 && (actual->tt_member == &t_any || actual->tt_argcount < 0))) 737 && (actual->tt_member == &t_any || actual->tt_argcount < 0)))
3579 garray_T *stack = &cctx->ctx_type_stack; 3579 garray_T *stack = &cctx->ctx_type_stack;
3580 type_T *actual; 3580 type_T *actual;
3581 3581
3582 generate_ppconst(cctx, ppconst); 3582 generate_ppconst(cctx, ppconst);
3583 actual = ((type_T **)stack->ga_data)[stack->ga_len - 1]; 3583 actual = ((type_T **)stack->ga_data)[stack->ga_len - 1];
3584 if (check_type(want_type, actual, FALSE) == FAIL) 3584 if (check_type(want_type, actual, FALSE, 0) == FAIL)
3585 { 3585 {
3586 if (need_type(actual, want_type, -1, cctx, FALSE) == FAIL) 3586 if (need_type(actual, want_type, -1, cctx, FALSE) == FAIL)
3587 return FAIL; 3587 return FAIL;
3588 } 3588 }
3589 } 3589 }
6498 if (ufunc->uf_arg_types[arg_idx] == &t_unknown) 6498 if (ufunc->uf_arg_types[arg_idx] == &t_unknown)
6499 { 6499 {
6500 did_set_arg_type = TRUE; 6500 did_set_arg_type = TRUE;
6501 ufunc->uf_arg_types[arg_idx] = val_type; 6501 ufunc->uf_arg_types[arg_idx] = val_type;
6502 } 6502 }
6503 else if (check_type(ufunc->uf_arg_types[arg_idx], val_type, FALSE) 6503 else if (check_type(ufunc->uf_arg_types[arg_idx], val_type,
6504 == FAIL) 6504 TRUE, arg_idx + 1) == FAIL)
6505 {
6506 arg_type_mismatch(ufunc->uf_arg_types[arg_idx], val_type,
6507 arg_idx + 1);
6508 goto erret; 6505 goto erret;
6509 }
6510 6506
6511 if (generate_STORE(&cctx, ISN_STORE, i - count - off, NULL) == FAIL) 6507 if (generate_STORE(&cctx, ISN_STORE, i - count - off, NULL) == FAIL)
6512 goto erret; 6508 goto erret;
6513 } 6509 }
6514 ufunc->uf_def_arg_idx[count] = instr->ga_len; 6510 ufunc->uf_def_arg_idx[count] = instr->ga_len;