comparison src/vim9execute.c @ 22500:ef8a3177edc1 v8.2.1798

patch 8.2.1798: Vim9: trinary operator condition is too permissive Commit: https://github.com/vim/vim/commit/1310660557470a669cc64b359e20666b116e5dbd Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 4 16:06:05 2020 +0200 patch 8.2.1798: Vim9: trinary operator condition is too permissive Problem: Vim9: trinary operator condition is too permissive. Solution: Use tv_get_bool_chk().
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Oct 2020 16:15:04 +0200
parents 4c21f7f6f9e3
children c3e3c5707fe9
comparison
equal deleted inserted replaced
22499:8db2a5f8c40a 22500:ef8a3177edc1
1906 1906
1907 if (when != JUMP_ALWAYS) 1907 if (when != JUMP_ALWAYS)
1908 { 1908 {
1909 tv = STACK_TV_BOT(-1); 1909 tv = STACK_TV_BOT(-1);
1910 if (when == JUMP_IF_COND_FALSE 1910 if (when == JUMP_IF_COND_FALSE
1911 || when == JUMP_IF_FALSE
1911 || when == JUMP_IF_COND_TRUE) 1912 || when == JUMP_IF_COND_TRUE)
1912 { 1913 {
1913 SOURCING_LNUM = iptr->isn_lnum; 1914 SOURCING_LNUM = iptr->isn_lnum;
1914 jump = tv_get_bool_chk(tv, &error); 1915 jump = tv_get_bool_chk(tv, &error);
1915 if (error) 1916 if (error)
3401 break; 3402 break;
3402 } 3403 }
3403 } 3404 }
3404 3405
3405 /* 3406 /*
3406 * Return TRUE when "tv" is not falsey: non-zero, non-empty string, non-empty 3407 * Return TRUE when "tv" is not falsy: non-zero, non-empty string, non-empty
3407 * list, etc. Mostly like what JavaScript does, except that empty list and 3408 * list, etc. Mostly like what JavaScript does, except that empty list and
3408 * empty dictionary are FALSE. 3409 * empty dictionary are FALSE.
3409 */ 3410 */
3410 int 3411 int
3411 tv2bool(typval_T *tv) 3412 tv2bool(typval_T *tv)