This commit is contained in:
aps 2023-02-15 12:40:06 -05:00
parent 4c8b5236e7
commit 5bc30984c2
2 changed files with 9 additions and 4 deletions

View File

@ -503,6 +503,7 @@ private:
} }
void exprGrouping() { void exprGrouping() {
// co()->_rvalue = true;
match_newlines(mode()==REPL_MODE); match_newlines(mode()==REPL_MODE);
do { do {
if (peek() == TK(")")) break; if (peek() == TK(")")) break;
@ -518,16 +519,18 @@ private:
// and push it on the stack as well, // and push it on the stack as well,
// so it is available as a value // so it is available as a value
// in the expression // in the expression
emit(OP_LOAD_NAME_REF, index);
consume(TK(":=")); consume(TK(":="));
emit(OP_LOAD_NAME_REF, index);
EXPR(); EXPR();
// emit(OP_LOAD_NAME, index);
emit(OP_STORE_REF); emit(OP_STORE_REF);
emit(OP_LOAD_NAME, index); //emit(OP_LOAD_NAME_REF, index);;
} }
else EXPR_TUPLE(); else EXPR();
} while (match(TK(","))); } while (match(TK(",")));
match_newlines(mode()==REPL_MODE); match_newlines(mode()==REPL_MODE);
consume(TK(")")); consume(TK(")"));
// co()->_rvalue = false;
} }
void exprList() { void exprList() {

View File

@ -119,7 +119,9 @@ assert round(-23.2) == -23
assert round(-23.8) == -24 assert round(-23.8) == -24
assert (x := 1) == 1 assert (x := 1) == 1
assert (a := 1, b := 2) assert (x := 1, y := 2 ) == (1, 2)
z = (a := 1, b := 2)
print(z)
assert a == 1 assert a == 1
assert b == 2 assert b == 2