Mercurial > vim
diff src/vim9.h @ 24796:7c1375eb1636 v8.2.2936
patch 8.2.2936: Vim9: converting number to bool uses wrong stack offset
Commit: https://github.com/vim/vim/commit/5fa9b24440d677c1aa00084d0cf84638b1e1a0d5
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 4 21:00:32 2021 +0200
patch 8.2.2936: Vim9: converting number to bool uses wrong stack offset
Problem: Vim9: converting number to bool uses wrong stack offset. (Salman
Halim)
Solution: Include the offset in the 2BOOL command.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 04 Jun 2021 21:15:04 +0200 |
parents | 668df21d8bc6 |
children | a8d64f1a223b |
line wrap: on
line diff
--- a/src/vim9.h +++ b/src/vim9.h @@ -148,9 +148,9 @@ typedef enum { ISN_GETITEM, // push list item, isn_arg.number is the index ISN_MEMBER, // dict[member] ISN_STRINGMEMBER, // dict.member using isn_arg.string - ISN_2BOOL, // falsy/truthy to bool, invert if isn_arg.number != 0 + ISN_2BOOL, // falsy/truthy to bool, uses isn_arg.tobool ISN_COND2BOOL, // convert value to bool - ISN_2STRING, // convert value to string at isn_arg.number on stack + ISN_2STRING, // convert value to string at isn_arg.tostring on stack ISN_2STRING_ANY, // like ISN_2STRING but check type ISN_NEGATENR, // apply "-" to number @@ -369,6 +369,18 @@ typedef struct { cexprref_T *cexpr_ref; } cexpr_T; +// arguments to ISN_2STRING and ISN_2STRING_ANY +typedef struct { + int offset; + int tolerant; +} tostring_T; + +// arguments to ISN_2BOOL +typedef struct { + int offset; + int invert; +} tobool_T; + /* * Instruction */ @@ -414,6 +426,8 @@ struct isn_S { subs_T subs; cexpr_T cexpr; isn_T *instr; + tostring_T tostring; + tobool_T tobool; } isn_arg; };