mirror of https://github.com/arendst/Tasmota.git
Merge pull request #13996 from s-hadinger/berry_instance_func
Berry allow instance functions
This commit is contained in:
commit
7465f550d1
|
@ -853,9 +853,9 @@ newframe: /* a new call frame */
|
|||
reg = vm->reg;
|
||||
bvalue *a = RA();
|
||||
*a = a_temp;
|
||||
if (basetype(type) == BE_FUNCTION) {
|
||||
if (func_isstatic(a)) {
|
||||
/* static method, don't bother with the instance */
|
||||
if (var_basetype(a) == BE_FUNCTION) {
|
||||
if (func_isstatic(a) || (type == BE_INDEX)) { /* if instance variable then we consider it's non-method */
|
||||
/* static method, don't bother with the instance */
|
||||
a[1] = a_temp;
|
||||
var_settype(a, NOT_METHOD);
|
||||
} else {
|
||||
|
|
|
@ -64,7 +64,7 @@ A.h = def (x, y) return type(x) end
|
|||
assert(type(a.g) == 'function')
|
||||
assert(type(a.h) == 'function')
|
||||
|
||||
assert_attribute_error("a.g(1,2)")
|
||||
assert(a.g(1) == 'int')
|
||||
assert(a.h(1) == 'int')
|
||||
assert(A.h(1) == 'int')
|
||||
|
||||
|
@ -85,6 +85,9 @@ assert(a.g(1,2) == [1,2])
|
|||
assert(a.h(1,2) == [1,2])
|
||||
assert(A.g(1,2) == [1,2])
|
||||
assert(A.h(1,2) == [1,2])
|
||||
a.a = def (x,y) return [x,y] end
|
||||
assert(a.a(1,2) == [1,2])
|
||||
|
||||
|
||||
#- test static initializers -#
|
||||
class A
|
||||
|
|
Loading…
Reference in New Issue