]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.0.2169: Vim9: builtin funcs may accept a non-value v9.0.2169
authorErnie Rael <errael@raelity.com>
Sat, 16 Dec 2023 13:03:33 +0000 (14:03 +0100)
committerChristian Brabandt <cb@256bit.org>
Sat, 16 Dec 2023 13:03:33 +0000 (14:03 +0100)
commitd8bf87c9fbd92fd6b837446e886d47e557adadbc
tree0a3ef3beef2fa291e2851bc5764a7bbb15b99e11
parentdf12e39b8b9dd39056e22b452276622cb7b617fd
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>
src/evalfunc.c
src/proto/vim9type.pro
src/testdir/test_vim9_builtin.vim
src/testdir/test_vim9_typealias.vim
src/version.c
src/vim9expr.c
src/vim9type.c