comparison src/vim9compile.c @ 23106:b0c88aa0175b v8.2.2099

patch 8.2.2099: Vim9: some checks are not tested Commit: https://github.com/vim/vim/commit/918a4249176a8ccec3a34c9c7ef7bf4163676a63 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 6 14:37:08 2020 +0100 patch 8.2.2099: Vim9: some checks are not tested Problem: Vim9: some checks are not tested. Solution: Add a few more tests. Give better error messages.
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Dec 2020 14:45:04 +0100
parents 9c3a6c33c0e5
children 545ff3b4543c
comparison
equal deleted inserted replaced
23105:65d66ab963c2 23106:b0c88aa0175b
2501 break; 2501 break;
2502 case 'g': isn_type = ISN_LOADG; break; 2502 case 'g': isn_type = ISN_LOADG; break;
2503 case 'w': isn_type = ISN_LOADW; break; 2503 case 'w': isn_type = ISN_LOADW; break;
2504 case 't': isn_type = ISN_LOADT; break; 2504 case 't': isn_type = ISN_LOADT; break;
2505 case 'b': isn_type = ISN_LOADB; break; 2505 case 'b': isn_type = ISN_LOADB; break;
2506 default: semsg(_(e_namespace_not_supported_str), *arg); 2506 default: // cannot happen, just in case
2507 semsg(_(e_namespace_not_supported_str), *arg);
2507 goto theend; 2508 goto theend;
2508 } 2509 }
2509 if (isn_type != ISN_DROP) 2510 if (isn_type != ISN_DROP)
2510 { 2511 {
2511 // Global, Buffer-local, Window-local and Tabpage-local 2512 // Global, Buffer-local, Window-local and Tabpage-local
3579 // missing second index is equal to end of string 3580 // missing second index is equal to end of string
3580 generate_PUSHNR(cctx, -1); 3581 generate_PUSHNR(cctx, -1);
3581 else 3582 else
3582 { 3583 {
3583 if (compile_expr0(arg, cctx) == FAIL) 3584 if (compile_expr0(arg, cctx) == FAIL)
3584 return FAIL; 3585 return FAIL;
3585 if (may_get_next_line_error(p, arg, cctx) == FAIL) 3586 if (may_get_next_line_error(p, arg, cctx) == FAIL)
3586 return FAIL; 3587 return FAIL;
3587 *arg = skipwhite(*arg); 3588 *arg = skipwhite(*arg);
3588 } 3589 }
3589 is_slice = TRUE; 3590 is_slice = TRUE;
4082 { 4083 {
4083 error_white_both(op, 1); 4084 error_white_both(op, 1);
4084 return FAIL; 4085 return FAIL;
4085 } 4086 }
4086 *arg = skipwhite(op + 1); 4087 *arg = skipwhite(op + 1);
4087 if (may_get_next_line(op + 1, arg, cctx) == FAIL) 4088 if (may_get_next_line_error(op + 1, arg, cctx) == FAIL)
4088 return FAIL; 4089 return FAIL;
4089 4090
4090 // get the second expression 4091 // get the second expression
4091 if (compile_expr7t(arg, cctx, ppconst) == FAIL) 4092 if (compile_expr7t(arg, cctx, ppconst) == FAIL)
4092 return FAIL; 4093 return FAIL;
4289 return FAIL; 4290 return FAIL;
4290 } 4291 }
4291 4292
4292 // get the second variable 4293 // get the second variable
4293 *arg = skipwhite(p + len); 4294 *arg = skipwhite(p + len);
4294 if (may_get_next_line(p + len, arg, cctx) == FAIL) 4295 if (may_get_next_line_error(p + len, arg, cctx) == FAIL)
4295 return FAIL; 4296 return FAIL;
4296 4297
4297 if (compile_expr5(arg, cctx, ppconst) == FAIL) 4298 if (compile_expr5(arg, cctx, ppconst) == FAIL)
4298 return FAIL; 4299 return FAIL;
4299 4300
4388 generate_JUMP(cctx, opchar == '|' 4389 generate_JUMP(cctx, opchar == '|'
4389 ? JUMP_IF_COND_TRUE : JUMP_IF_COND_FALSE, 0); 4390 ? JUMP_IF_COND_TRUE : JUMP_IF_COND_FALSE, 0);
4390 4391
4391 // eval the next expression 4392 // eval the next expression
4392 *arg = skipwhite(p + 2); 4393 *arg = skipwhite(p + 2);
4393 if (may_get_next_line(p + 2, arg, cctx) == FAIL) 4394 if (may_get_next_line_error(p + 2, arg, cctx) == FAIL)
4394 return FAIL; 4395 return FAIL;
4395 4396
4396 if ((opchar == '|' ? compile_expr3(arg, cctx, ppconst) 4397 if ((opchar == '|' ? compile_expr3(arg, cctx, ppconst)
4397 : compile_expr4(arg, cctx, ppconst)) == FAIL) 4398 : compile_expr4(arg, cctx, ppconst)) == FAIL)
4398 { 4399 {
4582 type1 = ((type_T **)stack->ga_data)[stack->ga_len]; 4583 type1 = ((type_T **)stack->ga_data)[stack->ga_len];
4583 } 4584 }
4584 4585
4585 // evaluate the second expression; any type is accepted 4586 // evaluate the second expression; any type is accepted
4586 *arg = skipwhite(p + 1 + op_falsy); 4587 *arg = skipwhite(p + 1 + op_falsy);
4587 if (may_get_next_line(p + 1 + op_falsy, arg, cctx) == FAIL) 4588 if (may_get_next_line_error(p + 1 + op_falsy, arg, cctx) == FAIL)
4588 return FAIL; 4589 return FAIL;
4589 if (compile_expr1(arg, cctx, ppconst) == FAIL) 4590 if (compile_expr1(arg, cctx, ppconst) == FAIL)
4590 return FAIL; 4591 return FAIL;
4591 4592
4592 if (!has_const_expr) 4593 if (!has_const_expr)
4632 // evaluate the third expression 4633 // evaluate the third expression
4633 if (has_const_expr) 4634 if (has_const_expr)
4634 cctx->ctx_skip = save_skip == SKIP_YES || const_value 4635 cctx->ctx_skip = save_skip == SKIP_YES || const_value
4635 ? SKIP_YES : SKIP_NOT; 4636 ? SKIP_YES : SKIP_NOT;
4636 *arg = skipwhite(p + 1); 4637 *arg = skipwhite(p + 1);
4637 if (may_get_next_line(p + 1, arg, cctx) == FAIL) 4638 if (may_get_next_line_error(p + 1, arg, cctx) == FAIL)
4638 return FAIL; 4639 return FAIL;
4639 if (compile_expr1(arg, cctx, ppconst) == FAIL) 4640 if (compile_expr1(arg, cctx, ppconst) == FAIL)
4640 return FAIL; 4641 return FAIL;
4641 } 4642 }
4642 4643