Mercurial > vim
comparison src/vim9execute.c @ 22633:6589dae9696c v8.2.1865
patch 8.2.1865: Vim9: add() does not check type of argument
Commit: https://github.com/vim/vim/commit/1dcae59957301b6b19aef49af648715f911a1378
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Oct 19 19:02:42 2020 +0200
patch 8.2.1865: Vim9: add() does not check type of argument
Problem: Vim9: add() does not check type of argument.
Solution: Inline the add() call. (closes https://github.com/vim/vim/issues/7160)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 19 Oct 2020 19:15:04 +0200 |
parents | 672ee41a6a3b |
children | 4d4042683371 |
comparison
equal
deleted
inserted
replaced
22632:89aa39d70c67 | 22633:6589dae9696c |
---|---|
2093 tv = STACK_TV_BOT(0); | 2093 tv = STACK_TV_BOT(0); |
2094 if (tv->vval.v_string == NULL | 2094 if (tv->vval.v_string == NULL |
2095 || *skipwhite(tv->vval.v_string) == NUL) | 2095 || *skipwhite(tv->vval.v_string) == NUL) |
2096 { | 2096 { |
2097 vim_free(tv->vval.v_string); | 2097 vim_free(tv->vval.v_string); |
2098 SOURCING_LNUM = iptr->isn_lnum; | |
2098 emsg(_(e_throw_with_empty_string)); | 2099 emsg(_(e_throw_with_empty_string)); |
2099 goto failed; | 2100 goto failed; |
2100 } | 2101 } |
2101 | 2102 |
2102 if (throw_exception(tv->vval.v_string, ET_USER, NULL) == FAIL) | 2103 if (throw_exception(tv->vval.v_string, ET_USER, NULL) == FAIL) |
2280 case ISN_ADDBLOB: | 2281 case ISN_ADDBLOB: |
2281 { | 2282 { |
2282 typval_T *tv1 = STACK_TV_BOT(-2); | 2283 typval_T *tv1 = STACK_TV_BOT(-2); |
2283 typval_T *tv2 = STACK_TV_BOT(-1); | 2284 typval_T *tv2 = STACK_TV_BOT(-1); |
2284 | 2285 |
2286 // add two lists or blobs | |
2285 if (iptr->isn_type == ISN_ADDLIST) | 2287 if (iptr->isn_type == ISN_ADDLIST) |
2286 eval_addlist(tv1, tv2); | 2288 eval_addlist(tv1, tv2); |
2287 else | 2289 else |
2288 eval_addblob(tv1, tv2); | 2290 eval_addblob(tv1, tv2); |
2289 clear_tv(tv2); | 2291 clear_tv(tv2); |
2292 --ectx.ec_stack.ga_len; | |
2293 } | |
2294 break; | |
2295 | |
2296 case ISN_LISTAPPEND: | |
2297 { | |
2298 typval_T *tv1 = STACK_TV_BOT(-2); | |
2299 typval_T *tv2 = STACK_TV_BOT(-1); | |
2300 list_T *l = tv1->vval.v_list; | |
2301 | |
2302 // add an item to a list | |
2303 if (l == NULL) | |
2304 { | |
2305 SOURCING_LNUM = iptr->isn_lnum; | |
2306 emsg(_(e_cannot_add_to_null_list)); | |
2307 goto on_error; | |
2308 } | |
2309 if (list_append_tv(l, tv2) == FAIL) | |
2310 goto failed; | |
2290 --ectx.ec_stack.ga_len; | 2311 --ectx.ec_stack.ga_len; |
2291 } | 2312 } |
2292 break; | 2313 break; |
2293 | 2314 |
2294 // Computation with two arguments of unknown type | 2315 // Computation with two arguments of unknown type |
3408 | 3429 |
3409 // expression operations | 3430 // expression operations |
3410 case ISN_CONCAT: smsg("%4d CONCAT", current); break; | 3431 case ISN_CONCAT: smsg("%4d CONCAT", current); break; |
3411 case ISN_STRINDEX: smsg("%4d STRINDEX", current); break; | 3432 case ISN_STRINDEX: smsg("%4d STRINDEX", current); break; |
3412 case ISN_STRSLICE: smsg("%4d STRSLICE", current); break; | 3433 case ISN_STRSLICE: smsg("%4d STRSLICE", current); break; |
3434 case ISN_LISTAPPEND: smsg("%4d LISTAPPEND", current); break; | |
3413 case ISN_LISTINDEX: smsg("%4d LISTINDEX", current); break; | 3435 case ISN_LISTINDEX: smsg("%4d LISTINDEX", current); break; |
3414 case ISN_LISTSLICE: smsg("%4d LISTSLICE", current); break; | 3436 case ISN_LISTSLICE: smsg("%4d LISTSLICE", current); break; |
3415 case ISN_ANYINDEX: smsg("%4d ANYINDEX", current); break; | 3437 case ISN_ANYINDEX: smsg("%4d ANYINDEX", current); break; |
3416 case ISN_ANYSLICE: smsg("%4d ANYSLICE", current); break; | 3438 case ISN_ANYSLICE: smsg("%4d ANYSLICE", current); break; |
3417 case ISN_SLICE: smsg("%4d SLICE %lld", | 3439 case ISN_SLICE: smsg("%4d SLICE %lld", |