From 95f7e3967244731a16ecd4c733a1cc4dea4a6574 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Fri, 1 Aug 2025 22:44:49 +0200 Subject: [PATCH] Berry `call()` now works for classes (#23744) --- CHANGELOG.md | 1 + lib/libesp32/berry/src/be_baselib.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e93b74da..00a859c5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. - ESP32-P4 command `HostedOta` (#23675) - Support for RV3028 RTC (#23672) - Berry preview of animation framework (#23740) +- Berry `call()` now works for classes ### Breaking Changed diff --git a/lib/libesp32/berry/src/be_baselib.c b/lib/libesp32/berry/src/be_baselib.c index 2a8d36fd6..ae55b6306 100644 --- a/lib/libesp32/berry/src/be_baselib.c +++ b/lib/libesp32/berry/src/be_baselib.c @@ -319,7 +319,7 @@ int be_baselib_iterator(bvm *vm) static int l_call(bvm *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 */ /* test if last argument is a list */ @@ -354,7 +354,7 @@ static int l_call(bvm *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); }