comparison runtime/doc/builtin.txt @ 33924:ccdb948c7273 v9.0.2160

patch 9.0.2160: instanceof() should use varargs as second arg Commit: https://github.com/vim/vim/commit/2025af165ec68d831f0f0f668a3ceac3f39142ef Author: Ernie Rael <errael@raelity.com> Date: Tue Dec 12 16:58:00 2023 +0100 patch 9.0.2160: instanceof() should use varargs as second arg Problem: instanceof() should use varargs as second arg Solution: Modify `instanceof()` to use varargs instead of list Modify `instanceof()` to use varargs instead of list Valid `instanceof()` arguments are `type`s. A `type` is not a value; it cannot be added to a list. This change is non-compatible with the current usage of instanceof; but instanceof is relatively new and it's a trivial change. fixes: #13421 closes: #13644 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 12 Dec 2023 17:15:03 +0100
parents c3804ff17204
children 050160b94f02
comparison
equal deleted inserted replaced
33923:b1e48fed6e55 33924:ccdb948c7273
5056 mylist->insert(item) 5056 mylist->insert(item)
5057 < 5057 <
5058 *instanceof()* *E614* *E616* *E693* 5058 *instanceof()* *E614* *E616* *E693*
5059 instanceof({object}, {class}) 5059 instanceof({object}, {class})
5060 The result is a Number, which is |TRUE| when the {object} 5060 The result is a Number, which is |TRUE| when the {object}
5061 argument is a direct or indirect instance of a |Class| 5061 argument is a direct or indirect instance of a |Class|,
5062 specified by {class}. 5062 |Interface|, or class |:type| alias specified by {class}.
5063 When {class} is a |List| the function returns |TRUE| when 5063 If {class} is varargs, the function returns |TRUE| when
5064 {object} is an instance of any of the specified classes. 5064 {object} is an instance of any of the specified classes.
5065 Example: > 5065 Example: >
5066 instanceof(animal, [Dog, Cat]) 5066 instanceof(animal, Dog, Cat)
5067 5067
5068 < Can also be used as a |method|: > 5068 < Can also be used as a |method|: >
5069 myobj->instanceof(mytype) 5069 myobj->instanceof(mytype)
5070 5070
5071 interrupt() *interrupt()* 5071 interrupt() *interrupt()*