mirror of https://github.com/arendst/Tasmota.git
Berry fix wrong parameter for virtual method
This commit is contained in:
parent
6c2448b5cf
commit
079eb117bf
|
@ -283,8 +283,8 @@ static int obj_attribute(bvm *vm, bvalue *o, bvalue *c, bvalue *dst)
|
||||||
vm->top += 3; /* prevent collection results */
|
vm->top += 3; /* prevent collection results */
|
||||||
be_dofunc(vm, top, 2); /* call method 'member' */
|
be_dofunc(vm, top, 2); /* call method 'member' */
|
||||||
vm->top -= 3;
|
vm->top -= 3;
|
||||||
*o = *vm->top; /* copy result to R(A) */
|
*dst = *vm->top; /* copy result to R(A) */
|
||||||
type = var_type(o);
|
type = var_type(dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (basetype(type) == BE_NIL) {
|
if (basetype(type) == BE_NIL) {
|
||||||
|
|
|
@ -296,7 +296,7 @@ extern "C" {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
obj2 = (lv_obj_t*) be_convert_single_elt(vm, 3);
|
obj2 = (lv_obj_t*) be_convert_single_elt(vm, 3);
|
||||||
}
|
}
|
||||||
// AddLog(LOG_LEVEL_INFO, "argc %d lv_obj %p", argc, obj);
|
// AddLog(LOG_LEVEL_INFO, "argc %d obj1 %p obj2 %p", argc, obj1, obj2);
|
||||||
fn_any_callable f = (fn_any_callable) func;
|
fn_any_callable f = (fn_any_callable) func;
|
||||||
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func(%p) - %p,%p,%p,%p,%p", f, p[0], p[1], p[2], p[3], p[4]);
|
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func(%p) - %p,%p,%p,%p,%p", f, p[0], p[1], p[2], p[3], p[4]);
|
||||||
lv_obj_t * obj;
|
lv_obj_t * obj;
|
||||||
|
@ -340,6 +340,7 @@ extern "C" {
|
||||||
|
|
||||||
// native closure to call `be_call_c_func`
|
// native closure to call `be_call_c_func`
|
||||||
int lvx_call_c(bvm *vm) {
|
int lvx_call_c(bvm *vm) {
|
||||||
|
// berry_log_C("lvx_call_c enter");
|
||||||
// keep parameters unchanged
|
// keep parameters unchanged
|
||||||
be_getupval(vm, 0, 0); // if index is zero, it's the current native closure
|
be_getupval(vm, 0, 0); // if index is zero, it's the current native closure
|
||||||
void * func = be_tocomptr(vm, -1);
|
void * func = be_tocomptr(vm, -1);
|
||||||
|
@ -375,9 +376,8 @@ extern "C" {
|
||||||
int32_t method_idx = bin_search(method_name, methods_calls, sizeof(lvbe_call_c_t), methods_size);
|
int32_t method_idx = bin_search(method_name, methods_calls, sizeof(lvbe_call_c_t), methods_size);
|
||||||
if (method_idx >= 0) {
|
if (method_idx >= 0) {
|
||||||
// method found
|
// method found
|
||||||
// berry_log_C("lvx_member method found");
|
|
||||||
|
|
||||||
const lvbe_call_c_t * method = &methods_calls[method_idx];
|
const lvbe_call_c_t * method = &methods_calls[method_idx];
|
||||||
|
// berry_log_C("lvx_member method found func=%p return_type=%s arg_type=%s", method->func, method->return_type, method->arg_type);
|
||||||
// push native closure
|
// push native closure
|
||||||
be_pushntvclosure(vm, &lvx_call_c, 3); // 3 upvals
|
be_pushntvclosure(vm, &lvx_call_c, 3); // 3 upvals
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue