Mercurial > vim
diff src/vim9expr.c @ 31549:6f1cbee3d652 v9.0.1107
patch 9.0.1107: float constant not recognized as float
Commit: https://github.com/vim/vim/commit/73ade49c4b692e77d2c0b2ef0afbedbf55c5f946
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 27 20:54:41 2022 +0000
patch 9.0.1107: float constant not recognized as float
Problem: Float constant not recognized as float.
Solution: Check the vartype instead of comparing with t_float.
(closes #11754)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Dec 2022 22:00:05 +0100 |
parents | 1bebc2093e6b |
children | 67d9fbe516a3 |
line wrap: on
line diff
--- a/src/vim9expr.c +++ b/src/vim9expr.c @@ -1757,22 +1757,14 @@ compile_leader(cctx_T *cctx, int numeric --p; if (*p == '-' || *p == '+') { - int negate = *p == '-'; - isn_T *isn; - type_T *type; - - type = get_type_on_stack(cctx, 0); - if (type != &t_float && need_type(type, &t_number, + type_T *type = get_type_on_stack(cctx, 0); + if (type->tt_type != VAR_FLOAT && need_type(type, &t_number, -1, 0, cctx, FALSE, FALSE) == FAIL) return FAIL; // only '-' has an effect, for '+' we only check the type - if (negate) - { - isn = generate_instr(cctx, ISN_NEGATENR); - if (isn == NULL) - return FAIL; - } + if (*p == '-' && generate_instr(cctx, ISN_NEGATENR) == NULL) + return FAIL; } else if (numeric_only) {