diff src/vim9compile.c @ 23334:4b4f695e9cd1 v8.2.2210

patch 8.2.2210: Vim9: allocating a type to set TTFLAG_BOOL_OK Commit: https://github.com/vim/vim/commit/3868f59466ed5ff1c5624f40b93c0034ce62cb82 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 25 13:20:41 2020 +0100 patch 8.2.2210: Vim9: allocating a type to set TTFLAG_BOOL_OK Problem: Vim9: allocating a type to set TTFLAG_BOOL_OK. Solution: Add t_number_bool.
author Bram Moolenaar <Bram@vim.org>
date Fri, 25 Dec 2020 13:30:03 +0100
parents cdb706d5c43d
children 1f37fd20f851
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -931,17 +931,8 @@ generate_PUSHNR(cctx_T *cctx, varnumber_
     isn->isn_arg.number = number;
 
     if (number == 0 || number == 1)
-    {
-	type_T	*type = get_type_ptr(cctx->ctx_type_list);
-
 	// A 0 or 1 number can also be used as a bool.
-	if (type != NULL)
-	{
-	    type->tt_type = VAR_NUMBER;
-	    type->tt_flags = TTFLAG_BOOL_OK;
-	    ((type_T **)stack->ga_data)[stack->ga_len - 1] = type;
-	}
-    }
+	((type_T **)stack->ga_data)[stack->ga_len - 1] = &t_number_bool;
     return OK;
 }