Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -4369,13 +4369,33 @@ compile_catch(char_u *arg, cctx_T *cctx } else { + char_u *end; + char_u *pat; + char_u *tofree = NULL; + size_t len; + // Push v:exception, push {expr} and MATCH generate_instr_type(cctx, ISN_PUSHEXC, &t_string); - if (compile_expr1(&p, cctx) == FAIL) - return NULL; - - // TODO: check for strings? + end = skip_regexp(p + 1, *p, TRUE, &tofree); + if (*end != *p) + { + semsg(_("E1067: Separator mismatch: %s"), p); + vim_free(tofree); + return FAIL; + } + if (tofree == NULL) + len = end - (p + 1); + else + len = end - (tofree + 1); + pat = vim_strnsave(p + 1, len); + vim_free(tofree); + p += len + 2; + if (pat == NULL) + return FAIL; + if (generate_PUSHS(cctx, pat) == FAIL) + return FAIL; + if (generate_COMPARE(cctx, EXPR_MATCH, FALSE) == FAIL) return NULL;