Berry call() now works for classes (#23744)

This commit is contained in:
s-hadinger 2025-08-01 22:44:49 +02:00 committed by GitHub
parent 5416890f11
commit 95f7e39672
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- ESP32-P4 command `HostedOta` (#23675) - ESP32-P4 command `HostedOta` (#23675)
- Support for RV3028 RTC (#23672) - Support for RV3028 RTC (#23672)
- Berry preview of animation framework (#23740) - Berry preview of animation framework (#23740)
- Berry `call()` now works for classes
### Breaking Changed ### Breaking Changed

View File

@ -319,7 +319,7 @@ int be_baselib_iterator(bvm *vm)
static int l_call(bvm *vm) static int l_call(bvm *vm)
{ {
int top = be_top(vm); int top = be_top(vm);
if (top >= 1 && be_isfunction(vm, 1)) { if (top >= 1 && (be_isfunction(vm, 1) || be_isclass(vm, 1))) {
size_t arg_count = top - 1; /* we have at least 'top - 1' arguments */ size_t arg_count = top - 1; /* we have at least 'top - 1' arguments */
/* test if last argument is a list */ /* test if last argument is a list */
@ -354,7 +354,7 @@ static int l_call(bvm *vm)
be_return(vm); be_return(vm);
} }
be_raise(vm, "value_error", "first argument must be a function"); be_raise(vm, "value_error", "first argument must be a function or a class");
be_return_nil(vm); be_return_nil(vm);
} }