Mercurial > vim
comparison src/json.c @ 24822:5f8dd7b3ae41 v8.2.2949
patch 8.2.2949: tests failing because no error for float to string conversion
Commit: https://github.com/vim/vim/commit/3cfa5b16b06bcc034f6de77070fa779d698ab5e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 6 14:14:39 2021 +0200
patch 8.2.2949: tests failing because no error for float to string conversion
Problem: Tests failing because there is no error for float to string
conversion.
Solution: Change the check for failure to check for correct result. Make
some conversions strict in Vim9 script.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Jun 2021 14:15:04 +0200 |
parents | 661d15592d3c |
children | e8e2c4d33b9b |
comparison
equal
deleted
inserted
replaced
24821:0218caefb9b8 | 24822:5f8dd7b3ae41 |
---|---|
605 | 605 |
606 ga_init2(&stack, sizeof(json_dec_item_T), 100); | 606 ga_init2(&stack, sizeof(json_dec_item_T), 100); |
607 cur_item = res; | 607 cur_item = res; |
608 init_tv(&item); | 608 init_tv(&item); |
609 if (res != NULL) | 609 if (res != NULL) |
610 init_tv(res); | 610 init_tv(res); |
611 | 611 |
612 fill_numbuflen(reader); | 612 fill_numbuflen(reader); |
613 p = reader->js_buf + reader->js_used; | 613 p = reader->js_buf + reader->js_used; |
614 for (;;) | 614 for (;;) |
615 { | 615 { |
918 goto theend; | 918 goto theend; |
919 | 919 |
920 if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY | 920 if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY |
921 && cur_item != NULL) | 921 && cur_item != NULL) |
922 { | 922 { |
923 #ifdef FEAT_FLOAT | |
924 if (cur_item->v_type == VAR_FLOAT) | |
925 { | |
926 // cannot use a float as a key | |
927 emsg(_(e_float_as_string)); | |
928 retval = FAIL; | |
929 goto theend; | |
930 } | |
931 #endif | |
923 top_item->jd_key = tv_get_string_buf_chk(cur_item, key_buf); | 932 top_item->jd_key = tv_get_string_buf_chk(cur_item, key_buf); |
924 if (top_item->jd_key == NULL) | 933 if (top_item->jd_key == NULL) |
925 { | 934 { |
926 emsg(_(e_invarg)); | 935 emsg(_(e_invarg)); |
927 retval = FAIL; | 936 retval = FAIL; |