Mercurial > vim
comparison src/proto/vim9type.pro @ 33949:84b93d95a952 v9.0.2169
patch 9.0.2169: Vim9: builtin funcs may accept a non-value
Commit: https://github.com/vim/vim/commit/d8bf87c9fbd92fd6b837446e886d47e557adadbc
Author: Ernie Rael <errael@raelity.com>
Date: Sat Dec 16 14:03:33 2023 +0100
patch 9.0.2169: Vim9: builtin funcs may accept a non-value
Problem: Vim9: builtin funcs may accept a non-value
Solution: Restrict builtin functions that accept `type`
This PR finishes off detection and prevention of using a type as a
value. It takes care of builtin functions. However there are some
builtin functions, that need to be able to handle types as well as
non-args: instanceof(), type(), typename(), string().
A "bit", FE_X, is added to funcentry_T; when set, the builtin function
can handle a type (class or type-alias) in addition to a value.
Noteworthy change: Discovered that in compile_call() the builtin add()
is compiled inline instead of calling the builtin. Had to add a check
there.
closes: #13688
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Dec 2023 14:15:03 +0100 |
parents | a49ae967e9ed |
children |
comparison
equal
deleted
inserted
replaced
33948:e858c9f6a9aa | 33949:84b93d95a952 |
---|---|
34 type_T *get_decl_type_on_stack(cctx_T *cctx, int offset); | 34 type_T *get_decl_type_on_stack(cctx_T *cctx, int offset); |
35 type_T *get_member_type_from_stack(int count, int skip, cctx_T *cctx); | 35 type_T *get_member_type_from_stack(int count, int skip, cctx_T *cctx); |
36 char *vartype_name(vartype_T type); | 36 char *vartype_name(vartype_T type); |
37 char *type_name(type_T *type, char **tofree); | 37 char *type_name(type_T *type, char **tofree); |
38 void f_typename(typval_T *argvars, typval_T *rettv); | 38 void f_typename(typval_T *argvars, typval_T *rettv); |
39 int check_vartype_is_value(vartype_T typ); | |
40 int check_typval_is_value(typval_T *tv); | 39 int check_typval_is_value(typval_T *tv); |
41 int check_type_is_value(type_T *type); | 40 int check_type_is_value(type_T *type); |
42 /* vim: set ft=c : */ | 41 /* vim: set ft=c : */ |