Mercurial > vim
comparison src/json.c @ 25384:e8e2c4d33b9b v8.2.3229
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Commit: https://github.com/vim/vim/commit/4490ec4e839e45a2e6923c265c7e9e64c240b805
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Jul 27 22:00:44 2021 +0200
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Problem: Vim9: runtime and compile time type checks are not the same.
Solution: Add more runtime type checks for builtin functions. (Yegappan
Lakshmanan, closes #8646)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Jul 2021 22:15:06 +0200 |
parents | 5f8dd7b3ae41 |
children | 763ea8f075db |
comparison
equal
deleted
inserted
replaced
25383:510e4fcb5363 | 25384:e8e2c4d33b9b |
---|---|
1154 void | 1154 void |
1155 f_js_decode(typval_T *argvars, typval_T *rettv) | 1155 f_js_decode(typval_T *argvars, typval_T *rettv) |
1156 { | 1156 { |
1157 js_read_T reader; | 1157 js_read_T reader; |
1158 | 1158 |
1159 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) | |
1160 return; | |
1161 | |
1159 reader.js_buf = tv_get_string(&argvars[0]); | 1162 reader.js_buf = tv_get_string(&argvars[0]); |
1160 reader.js_fill = NULL; | 1163 reader.js_fill = NULL; |
1161 reader.js_used = 0; | 1164 reader.js_used = 0; |
1162 if (json_decode_all(&reader, rettv, JSON_JS) != OK) | 1165 if (json_decode_all(&reader, rettv, JSON_JS) != OK) |
1163 emsg(_(e_invarg)); | 1166 emsg(_(e_invarg)); |
1179 void | 1182 void |
1180 f_json_decode(typval_T *argvars, typval_T *rettv) | 1183 f_json_decode(typval_T *argvars, typval_T *rettv) |
1181 { | 1184 { |
1182 js_read_T reader; | 1185 js_read_T reader; |
1183 | 1186 |
1187 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) | |
1188 return; | |
1189 | |
1184 reader.js_buf = tv_get_string(&argvars[0]); | 1190 reader.js_buf = tv_get_string(&argvars[0]); |
1185 reader.js_fill = NULL; | 1191 reader.js_fill = NULL; |
1186 reader.js_used = 0; | 1192 reader.js_used = 0; |
1187 json_decode_all(&reader, rettv, 0); | 1193 json_decode_all(&reader, rettv, 0); |
1188 } | 1194 } |