Mercurial > vim
comparison src/eval.c @ 26646:6f8d3470fa90 v8.2.3852
patch 8.2.3852: Vim9: not enough tests
Commit: https://github.com/vim/vim/commit/f47c5a8e2d8eda7c2c8a9cccf9568eb56c03a0cf
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 19 15:17:21 2021 +0000
patch 8.2.3852: Vim9: not enough tests
Problem: Vim9: not enough tests.
Solution: Also run existing tests for Vim9 script. Make errors more
consistent.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 Dec 2021 16:30:03 +0100 |
parents | 7fe649a64777 |
children | 2df40c348c70 |
comparison
equal
deleted
inserted
replaced
26645:6a31b4d210e0 | 26646:6f8d3470fa90 |
---|---|
4024 clear_tv(&var1); | 4024 clear_tv(&var1); |
4025 return FAIL; | 4025 return FAIL; |
4026 } | 4026 } |
4027 else if (evaluate) | 4027 else if (evaluate) |
4028 { | 4028 { |
4029 int error = FALSE; | |
4030 | |
4029 #ifdef FEAT_FLOAT | 4031 #ifdef FEAT_FLOAT |
4030 // allow for indexing with float | 4032 // allow for indexing with float |
4031 if (vim9 && rettv->v_type == VAR_DICT | 4033 if (vim9 && rettv->v_type == VAR_DICT |
4032 && var1.v_type == VAR_FLOAT) | 4034 && var1.v_type == VAR_FLOAT) |
4033 { | 4035 { |
4034 var1.vval.v_string = typval_tostring(&var1, TRUE); | 4036 var1.vval.v_string = typval_tostring(&var1, TRUE); |
4035 var1.v_type = VAR_STRING; | 4037 var1.v_type = VAR_STRING; |
4036 } | 4038 } |
4037 #endif | 4039 #endif |
4038 if (tv_get_string_chk(&var1) == NULL) | 4040 if (vim9 && rettv->v_type == VAR_LIST) |
4041 tv_get_number_chk(&var1, &error); | |
4042 else | |
4043 error = tv_get_string_chk(&var1) == NULL; | |
4044 if (error) | |
4039 { | 4045 { |
4040 // not a number or string | 4046 // not a number or string |
4041 clear_tv(&var1); | 4047 clear_tv(&var1); |
4042 return FAIL; | 4048 return FAIL; |
4043 } | 4049 } |
4116 switch (rettv->v_type) | 4122 switch (rettv->v_type) |
4117 { | 4123 { |
4118 case VAR_FUNC: | 4124 case VAR_FUNC: |
4119 case VAR_PARTIAL: | 4125 case VAR_PARTIAL: |
4120 if (verbose) | 4126 if (verbose) |
4121 emsg(_("E695: Cannot index a Funcref")); | 4127 emsg(_(e_cannot_index_a_funcref)); |
4122 return FAIL; | 4128 return FAIL; |
4123 case VAR_FLOAT: | 4129 case VAR_FLOAT: |
4124 #ifdef FEAT_FLOAT | 4130 #ifdef FEAT_FLOAT |
4125 if (verbose) | 4131 if (verbose) |
4126 emsg(_(e_float_as_string)); | 4132 emsg(_(e_float_as_string)); |