mirror of https://github.com/arendst/Tasmota.git
Berry sync with upstream
This commit is contained in:
parent
3a92189c44
commit
bcbef695ce
|
@ -220,7 +220,7 @@ static binstance* newobject(bvm *vm, bclass *c)
|
|||
/* Instanciate new instance from stack with argc parameters */
|
||||
/* Pushes the constructor on the stack to be executed if a construtor is found */
|
||||
/* Returns true if a constructor is found */
|
||||
bbool be_class_newobj(bvm *vm, bclass *c, int32_t pos, int argc, int mode)
|
||||
bbool be_class_newobj(bvm *vm, bclass *c, int pos, int argc, int mode)
|
||||
{
|
||||
bvalue init;
|
||||
binstance *obj = newobject(vm, c); /* create empty object hierarchy from class hierarchy */
|
||||
|
|
|
@ -58,7 +58,7 @@ void be_prim_method_bind(bvm *vm, bclass *c, bstring *name, bntvfunc f);
|
|||
void be_closure_method_bind(bvm *vm, bclass *c, bstring *name, bclosure *cl);
|
||||
int be_class_closure_count(bclass *c);
|
||||
void be_class_upvalue_init(bvm *vm, bclass *c);
|
||||
bbool be_class_newobj(bvm *vm, bclass *c, int32_t pos, int argc, int mode);
|
||||
bbool be_class_newobj(bvm *vm, bclass *c, int pos, int argc, int mode);
|
||||
int be_instance_member_simple(bvm *vm, binstance *obj, bstring *name, bvalue *dst);
|
||||
int be_instance_member(bvm *vm, binstance *obj, bstring *name, bvalue *dst);
|
||||
int be_class_member(bvm *vm, bclass *obj, bstring *name, bvalue *dst);
|
||||
|
|
|
@ -54,7 +54,7 @@ static int is_object(bvm *vm, const char *class, int idx)
|
|||
}
|
||||
be_remove(vm, -2);
|
||||
}
|
||||
const char *name = be_classname(vm, idx);
|
||||
const char *name = be_classname(vm, -1);
|
||||
bbool ret = !strcmp(name, class);
|
||||
be_pop(vm, 1);
|
||||
return ret;
|
||||
|
|
|
@ -330,7 +330,6 @@ static bstring* string_range(bvm *vm, bstring *str, binstance *range)
|
|||
{
|
||||
bint lower, upper;
|
||||
bint size = str_len(str); /* size of source string */
|
||||
// bint size = be_data_size(vm, -1); /* get source list size */
|
||||
/* get index range */
|
||||
bvalue temp;
|
||||
be_instance_member(vm, range, be_newstr(vm, "__lower__"), &temp);
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
_vm->cf->status = PRIM_FUNC; \
|
||||
}
|
||||
|
||||
static void prep_closure(bvm *vm, int32_t pos, int argc, int mode);
|
||||
static void prep_closure(bvm *vm, int pos, int argc, int mode);
|
||||
|
||||
static void attribute_error(bvm *vm, const char *t, bvalue *b, bvalue *c)
|
||||
{
|
||||
|
@ -1186,7 +1186,7 @@ newframe: /* a new call frame */
|
|||
}
|
||||
}
|
||||
|
||||
static void prep_closure(bvm *vm, int32_t pos, int argc, int mode)
|
||||
static void prep_closure(bvm *vm, int pos, int argc, int mode)
|
||||
{
|
||||
bvalue *v, *end;
|
||||
bproto *proto = var2cl(vm->reg + pos)->proto;
|
||||
|
@ -1211,7 +1211,7 @@ static void prep_closure(bvm *vm, int32_t pos, int argc, int mode)
|
|||
}
|
||||
}
|
||||
|
||||
static void do_closure(bvm *vm, int32_t pos, int argc)
|
||||
static void do_closure(bvm *vm, int pos, int argc)
|
||||
{
|
||||
// bvalue *v, *end;
|
||||
// bproto *proto = var2cl(reg)->proto;
|
||||
|
@ -1225,7 +1225,7 @@ static void do_closure(bvm *vm, int32_t pos, int argc)
|
|||
vm_exec(vm);
|
||||
}
|
||||
|
||||
static void do_ntvclos(bvm *vm, int32_t pos, int argc)
|
||||
static void do_ntvclos(bvm *vm, int pos, int argc)
|
||||
{
|
||||
bntvclos *f = var_toobj(vm->reg + pos);
|
||||
push_native(vm, vm->reg + pos, argc, 0);
|
||||
|
@ -1233,7 +1233,7 @@ static void do_ntvclos(bvm *vm, int32_t pos, int argc)
|
|||
ret_native(vm);
|
||||
}
|
||||
|
||||
static void do_ntvfunc(bvm *vm, int32_t pos, int argc)
|
||||
static void do_ntvfunc(bvm *vm, int pos, int argc)
|
||||
{
|
||||
bntvfunc f = var_tontvfunc(vm->reg + pos);
|
||||
push_native(vm, vm->reg + pos, argc, 0);
|
||||
|
@ -1241,7 +1241,7 @@ static void do_ntvfunc(bvm *vm, int32_t pos, int argc)
|
|||
ret_native(vm);
|
||||
}
|
||||
|
||||
static void do_class(bvm *vm, int32_t pos, int argc)
|
||||
static void do_class(bvm *vm, int pos, int argc)
|
||||
{
|
||||
if (be_class_newobj(vm, var_toobj(vm->reg + pos), pos, ++argc, 0)) {
|
||||
be_incrtop(vm);
|
||||
|
@ -1254,7 +1254,7 @@ void be_dofunc(bvm *vm, bvalue *v, int argc)
|
|||
{
|
||||
be_assert(vm->reg <= v && v < vm->stacktop);
|
||||
be_assert(vm->stack <= vm->reg && vm->reg < vm->stacktop);
|
||||
int32_t pos = v - vm->reg;
|
||||
int pos = v - vm->reg;
|
||||
switch (var_type(v)) {
|
||||
case BE_CLASS: do_class(vm, pos, argc); break;
|
||||
case BE_CLOSURE: do_closure(vm, pos, argc); break;
|
||||
|
|
Loading…
Reference in New Issue