mirror of https://github.com/arendst/Tasmota.git
This reverts commit 8f06552eee
.
This commit is contained in:
parent
8f06552eee
commit
cc55cf0bb1
|
@ -9,7 +9,6 @@ All notable changes to this project will be documented in this file.
|
||||||
- Matter add option to disable bridge mode (#18992)
|
- Matter add option to disable bridge mode (#18992)
|
||||||
- Support for SGP41 TVOC/NOx Sensor (#18880)
|
- Support for SGP41 TVOC/NOx Sensor (#18880)
|
||||||
- Command ``BrRestart`` to restart the Berry VM (experimental)
|
- Command ``BrRestart`` to restart the Berry VM (experimental)
|
||||||
- Berry `var` allowed in with walrus operator `:=`
|
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
- Berry `bool( [] )` and `bool( {} )` now evaluate as `false` (#18986)
|
- Berry `bool( [] )` and `bool( {} )` now evaluate as `false` (#18986)
|
||||||
|
|
Binary file not shown.
|
@ -1135,22 +1135,8 @@ static void sub_expr(bparser *parser, bexpdesc *e, int prio)
|
||||||
static void walrus_expr(bparser *parser, bexpdesc *e)
|
static void walrus_expr(bparser *parser, bexpdesc *e)
|
||||||
{
|
{
|
||||||
int line = parser->lexer.linenumber;
|
int line = parser->lexer.linenumber;
|
||||||
|
sub_expr(parser, e, ASSIGN_OP_PRIO); /* left expression */
|
||||||
btokentype op = next_type(parser);
|
btokentype op = next_type(parser);
|
||||||
if (op == KeyVar) {
|
|
||||||
/* 'var' ID ':=' expr */
|
|
||||||
scan_next_token(parser); /* skip 'var' */
|
|
||||||
bstring *name;
|
|
||||||
name = next_token(parser).u.s;
|
|
||||||
match_token(parser, TokenId); /* match and skip ID */
|
|
||||||
new_var(parser, name, e); /* new variable */
|
|
||||||
op = next_type(parser);
|
|
||||||
if (op != OptWalrus) {
|
|
||||||
parser_error(parser, "'var' in expr must be followed by ':='");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sub_expr(parser, e, ASSIGN_OP_PRIO); /* left expression */
|
|
||||||
op = next_type(parser);
|
|
||||||
}
|
|
||||||
if (op == OptWalrus) {
|
if (op == OptWalrus) {
|
||||||
check_symbol(parser, e);
|
check_symbol(parser, e);
|
||||||
bexpdesc e1 = *e; /* copy var to e1, e will get the result of expression */
|
bexpdesc e1 = *e; /* copy var to e1, e will get the result of expression */
|
||||||
|
@ -1163,7 +1149,8 @@ static void walrus_expr(bparser *parser, bexpdesc *e)
|
||||||
}
|
}
|
||||||
if (be_code_setvar(parser->finfo, &e1, e, btrue /* do not release register */ )) {
|
if (be_code_setvar(parser->finfo, &e1, e, btrue /* do not release register */ )) {
|
||||||
parser->lexer.linenumber = line;
|
parser->lexer.linenumber = line;
|
||||||
parser_error(parser, "try to assign constant expressions.");
|
parser_error(parser,
|
||||||
|
"try to assign constant expressions.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue