Merge branch 'development' of https://github.com/arendst/Tasmota into development

This commit is contained in:
Theo Arends 2021-06-06 18:05:37 +02:00
commit ad595a6537
2 changed files with 18 additions and 1 deletions

View File

@ -317,7 +317,7 @@ static void free_suffix(bfuncinfo *finfo, bexpdesc *e)
be_code_freeregs(finfo, 1);
}
/* release object register */
if (e->v.ss.tt == ETREG && (int)e->v.ss.obj >= nlocal) {
if (e->v.ss.tt == ETREG && (int)e->v.ss.obj >= nlocal && (e->v.ss.obj + 1 >= finfo->freereg)) {
be_code_freeregs(finfo, 1);
}
}

View File

@ -9,3 +9,20 @@ var pairs = {
for i : 0 .. keys.size() - 1
assert(pairs[keys[i]] == 'value' .. i + 1)
end
#- test cases related to #101 -#
class C var l end
c=C()
c.l=[0,1,2]
def t_101_nok_1() return c.l[0..1] end
def t_101_ok_1() var l2 = c.l return l2[0..1] end
t_i = 0
def t_101_nok_2() return c.l[t_i] end
def t_101_ok_2() return c.l[0] end
assert(t_101_nok_1() == [0, 1])
assert(t_101_ok_1() == [0, 1])
assert(t_101_nok_2() == 0)
assert(t_101_ok_2() == 0)