comparison src/vim9compile.c @ 19316:17dc6282f370 v8.2.0216

patch 8.2.0216: several Vim9 instructions are not tested Commit: https://github.com/vim/vim/commit/ff80cb6807d99db35cc928f151b87503b2928e19 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 5 22:10:05 2020 +0100 patch 8.2.0216: several Vim9 instructions are not tested Problem: Several Vim9 instructions are not tested. Solution: Add more tests. Fix :disassamble output. Make catch with pattern work.
author Bram Moolenaar <Bram@vim.org>
date Wed, 05 Feb 2020 22:15:03 +0100
parents 097c46668bd1
children e99e6d794597
comparison
equal deleted inserted replaced
19315:2a0fe5461ae5 19316:17dc6282f370
4367 scope->se_u.se_try.ts_caught_all = TRUE; 4367 scope->se_u.se_try.ts_caught_all = TRUE;
4368 scope->se_u.se_try.ts_catch_label = 0; 4368 scope->se_u.se_try.ts_catch_label = 0;
4369 } 4369 }
4370 else 4370 else
4371 { 4371 {
4372 char_u *end;
4373 char_u *pat;
4374 char_u *tofree = NULL;
4375 size_t len;
4376
4372 // Push v:exception, push {expr} and MATCH 4377 // Push v:exception, push {expr} and MATCH
4373 generate_instr_type(cctx, ISN_PUSHEXC, &t_string); 4378 generate_instr_type(cctx, ISN_PUSHEXC, &t_string);
4374 4379
4375 if (compile_expr1(&p, cctx) == FAIL) 4380 end = skip_regexp(p + 1, *p, TRUE, &tofree);
4376 return NULL; 4381 if (*end != *p)
4377 4382 {
4378 // TODO: check for strings? 4383 semsg(_("E1067: Separator mismatch: %s"), p);
4384 vim_free(tofree);
4385 return FAIL;
4386 }
4387 if (tofree == NULL)
4388 len = end - (p + 1);
4389 else
4390 len = end - (tofree + 1);
4391 pat = vim_strnsave(p + 1, len);
4392 vim_free(tofree);
4393 p += len + 2;
4394 if (pat == NULL)
4395 return FAIL;
4396 if (generate_PUSHS(cctx, pat) == FAIL)
4397 return FAIL;
4398
4379 if (generate_COMPARE(cctx, EXPR_MATCH, FALSE) == FAIL) 4399 if (generate_COMPARE(cctx, EXPR_MATCH, FALSE) == FAIL)
4380 return NULL; 4400 return NULL;
4381 4401
4382 scope->se_u.se_try.ts_catch_label = instr->ga_len; 4402 scope->se_u.se_try.ts_catch_label = instr->ga_len;
4383 if (generate_JUMP(cctx, JUMP_IF_FALSE, 0) == FAIL) 4403 if (generate_JUMP(cctx, JUMP_IF_FALSE, 0) == FAIL)