mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Berry fixed parser error with upvals in closures (#18902)
This commit is contained in:
parent
4a3b6457ca
commit
1e745807e4
@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Fixed HASPmota event when value is non-integer (fixes #18229)
|
- Fixed HASPmota event when value is non-integer (fixes #18229)
|
||||||
- Matter fix local Occupancy sensor
|
- Matter fix local Occupancy sensor
|
||||||
- Zigbee fixed regression with SetOption101
|
- Zigbee fixed regression with SetOption101
|
||||||
|
- Berry fixed parser error with upvals in closures
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -964,9 +964,10 @@ static void suffix_alloc_reg(bparser *parser, bexpdesc *l)
|
|||||||
bbool is_suffix = l->type == ETINDEX || l->type == ETMEMBER; /* is suffix */
|
bbool is_suffix = l->type == ETINDEX || l->type == ETMEMBER; /* is suffix */
|
||||||
bbool is_suffix_reg = l->v.ss.tt == ETREG || l->v.ss.tt == ETLOCAL || l->v.ss.tt == ETGLOBAL || l->v.ss.tt == ETNGLOBAL; /* if suffix, does it need a register */
|
bbool is_suffix_reg = l->v.ss.tt == ETREG || l->v.ss.tt == ETLOCAL || l->v.ss.tt == ETGLOBAL || l->v.ss.tt == ETNGLOBAL; /* if suffix, does it need a register */
|
||||||
bbool is_global = l->type == ETGLOBAL || l->type == ETNGLOBAL;
|
bbool is_global = l->type == ETGLOBAL || l->type == ETNGLOBAL;
|
||||||
|
bbool is_upval = l->type == ETUPVAL;
|
||||||
/* in the suffix expression, if the object is a temporary
|
/* in the suffix expression, if the object is a temporary
|
||||||
* variable (l->v.ss.tt == ETREG), it needs to be cached. */
|
* variable (l->v.ss.tt == ETREG), it needs to be cached. */
|
||||||
if (is_global || (is_suffix && is_suffix_reg)) {
|
if (is_global || is_upval || (is_suffix && is_suffix_reg)) {
|
||||||
be_code_allocregs(finfo, 1);
|
be_code_allocregs(finfo, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,3 +11,6 @@ tick()
|
|||||||
assert(l[0]() == [1, 100])
|
assert(l[0]() == [1, 100])
|
||||||
assert(l[1]() == [2, 100])
|
assert(l[1]() == [2, 100])
|
||||||
assert(l[2]() == [3, 100])
|
assert(l[2]() == [3, 100])
|
||||||
|
|
||||||
|
# the following failed to compile #344
|
||||||
|
def test() var nv = 1 var f = def() nv += 2*1 print(nv) end end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user