mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 13:00:17 +00:00
fix a bug
This commit is contained in:
parent
1ea7c151a3
commit
e5da206ded
@ -66,7 +66,7 @@ PyVar VM::run_frame(Frame* frame){
|
|||||||
frame->_pop();
|
frame->_pop();
|
||||||
continue;
|
continue;
|
||||||
case OP_BUILD_TUPLE: {
|
case OP_BUILD_TUPLE: {
|
||||||
pkpy::Args items = frame->pop_n_reversed(byte.arg);
|
pkpy::Args items = frame->pop_n_values_reversed(this, byte.arg);
|
||||||
frame->push(PyTuple(std::move(items)));
|
frame->push(PyTuple(std::move(items)));
|
||||||
} continue;
|
} continue;
|
||||||
case OP_BUILD_TUPLE_REF: {
|
case OP_BUILD_TUPLE_REF: {
|
||||||
|
@ -938,7 +938,7 @@ __LISTCOMP:
|
|||||||
emit(OP_RAISE, dummy_t);
|
emit(OP_RAISE, dummy_t);
|
||||||
consume_end_stmt();
|
consume_end_stmt();
|
||||||
} else if(match(TK("del"))){
|
} else if(match(TK("del"))){
|
||||||
EXPR();
|
EXPR_TUPLE();
|
||||||
emit(OP_DELETE_REF);
|
emit(OP_DELETE_REF);
|
||||||
consume_end_stmt();
|
consume_end_stmt();
|
||||||
} else if(match(TK("global"))){
|
} else if(match(TK("global"))){
|
||||||
@ -955,6 +955,7 @@ __LISTCOMP:
|
|||||||
// If last op is not an assignment, pop the result.
|
// If last op is not an assignment, pop the result.
|
||||||
uint8_t last_op = co()->codes.back().op;
|
uint8_t last_op = co()->codes.back().op;
|
||||||
if( last_op!=OP_STORE_NAME && last_op!=OP_STORE_REF && last_op!=OP_INPLACE_BINARY_OP && last_op!=OP_INPLACE_BITWISE_OP){
|
if( last_op!=OP_STORE_NAME && last_op!=OP_STORE_REF && last_op!=OP_INPLACE_BINARY_OP && last_op!=OP_INPLACE_BITWISE_OP){
|
||||||
|
if(last_op == OP_BUILD_TUPLE_REF) co()->codes.back().op = OP_BUILD_TUPLE;
|
||||||
if(mode()==REPL_MODE && name_scope() == NAME_GLOBAL) emit(OP_PRINT_EXPR, -1, true);
|
if(mode()==REPL_MODE && name_scope() == NAME_GLOBAL) emit(OP_PRINT_EXPR, -1, true);
|
||||||
emit(OP_POP_TOP, -1, true);
|
emit(OP_POP_TOP, -1, true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user