Mercurial > vim
comparison src/dict.c @ 23827:7e0d8f1cae7d v8.2.2455
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Commit: https://github.com/vim/vim/commit/2e5910bfbb05957c10c9c69756dfa342557e9a8b
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 3 17:41:24 2021 +0100
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Problem: Vim9: key type that can be used for literal dict and indexing is
inconsistent.
Solution: Allow using number and bool as key for a literal dict. (#7771)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 03 Feb 2021 17:45:06 +0100 |
parents | 6bfb302d8392 |
children | 85cf06ddb2a8 |
comparison
equal
deleted
inserted
replaced
23826:71d7c2500ee3 | 23827:7e0d8f1cae7d |
---|---|
951 clear_tv(&tvkey); | 951 clear_tv(&tvkey); |
952 goto failret; | 952 goto failret; |
953 } | 953 } |
954 if (evaluate) | 954 if (evaluate) |
955 { | 955 { |
956 if (vim9script && check_for_string(&tvkey) == FAIL) | 956 #ifdef FEAT_FLOAT |
957 { | 957 if (tvkey.v_type == VAR_FLOAT) |
958 clear_tv(&tvkey); | 958 { |
959 goto failret; | 959 tvkey.vval.v_string = typval_tostring(&tvkey, TRUE); |
960 } | 960 tvkey.v_type = VAR_STRING; |
961 } | |
962 #endif | |
961 key = tv_get_string_buf_chk(&tvkey, buf); | 963 key = tv_get_string_buf_chk(&tvkey, buf); |
962 if (key == NULL) | 964 if (key == NULL) |
963 { | 965 { |
964 // "key" is NULL when tv_get_string_buf_chk() gave an errmsg | 966 // "key" is NULL when tv_get_string_buf_chk() gave an errmsg |
965 clear_tv(&tvkey); | 967 clear_tv(&tvkey); |