diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-03-29 18:40:30 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-03-29 18:40:30 +0200 |
commit | c58164c5cff9845f3bf7cfcd75ace43208829388 (patch) | |
tree | 23870e26b6ae63b2109aa99af2527867f1343f3c /src/vim9execute.c | |
parent | 52ea92b19d2bc992dd4570add64c12d98eab9db2 (diff) | |
download | vim-git-c58164c5cff9845f3bf7cfcd75ace43208829388.tar.gz |
patch 8.2.0477: Vim9: error messages not testedv8.2.0477
Problem: Vim9: error messages not tested.
Solution: Add more tests.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r-- | src/vim9execute.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c index 5f6f79a15..4846c5521 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1612,7 +1612,21 @@ call_def_function( case ISN_NEGATENR: tv = STACK_TV_BOT(-1); - tv->vval.v_number = -tv->vval.v_number; + if (tv->v_type != VAR_NUMBER +#ifdef FEAT_FLOAT + && tv->v_type != VAR_FLOAT +#endif + ) + { + emsg(_(e_number_exp)); + goto failed; + } +#ifdef FEAT_FLOAT + if (tv->v_type == VAR_FLOAT) + tv->vval.v_float = -tv->vval.v_float; + else +#endif + tv->vval.v_number = -tv->vval.v_number; break; case ISN_CHECKNR: |