mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 13:00:17 +00:00
up
This commit is contained in:
parent
e4e43826fe
commit
e5ced9d194
@ -604,7 +604,8 @@ class Compiler {
|
|||||||
break;
|
break;
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
ctx()->emit_expr();
|
Expr_ rhs = ctx()->s_expr.popx();
|
||||||
|
rhs->emit(ctx());
|
||||||
bool ok = lhs_p->emit_store(ctx());
|
bool ok = lhs_p->emit_store(ctx());
|
||||||
if(!ok) SyntaxError();
|
if(!ok) SyntaxError();
|
||||||
return true;
|
return true;
|
||||||
|
21
src/vm.h
21
src/vm.h
@ -590,12 +590,25 @@ inline Str VM::disassemble(CodeObject_ co){
|
|||||||
ss << pad(line, 8) << pointer << pad(std::to_string(i), 3);
|
ss << pad(line, 8) << pointer << pad(std::to_string(i), 3);
|
||||||
ss << " " << pad(OP_NAMES[byte.op], 20) << " ";
|
ss << " " << pad(OP_NAMES[byte.op], 20) << " ";
|
||||||
// ss << pad(byte.arg == -1 ? "" : std::to_string(byte.arg), 5);
|
// ss << pad(byte.arg == -1 ? "" : std::to_string(byte.arg), 5);
|
||||||
std::string argStr = byte.arg == -1 ? "" : std::to_string(byte.arg);
|
Str argStr = byte.arg == -1 ? "" : std::to_string(byte.arg);
|
||||||
if(byte.op == OP_LOAD_CONST){
|
switch(byte.op){
|
||||||
|
case OP_LOAD_CONST:
|
||||||
argStr += " (" + CAST(Str, asRepr(co->consts[byte.arg])) + ")";
|
argStr += " (" + CAST(Str, asRepr(co->consts[byte.arg])) + ")";
|
||||||
}
|
break;
|
||||||
if(byte.op == OP_LOAD_NAME || byte.op == OP_STORE_LOCAL || byte.op == OP_STORE_GLOBAL){
|
case OP_LOAD_NAME: case OP_STORE_LOCAL: case OP_STORE_GLOBAL:
|
||||||
|
case OP_LOAD_ATTR: case OP_STORE_ATTR: case OP_DELETE_ATTR:
|
||||||
|
case OP_DELETE_LOCAL: case OP_DELETE_GLOBAL:
|
||||||
argStr += " (" + co->names[byte.arg].str().escape(true) + ")";
|
argStr += " (" + co->names[byte.arg].str().escape(true) + ")";
|
||||||
|
break;
|
||||||
|
case OP_BINARY_OP:
|
||||||
|
argStr += " (" + BINARY_SPECIAL_METHODS[byte.arg].str() + ")";
|
||||||
|
break;
|
||||||
|
case OP_COMPARE_OP:
|
||||||
|
argStr += " (" + COMPARE_SPECIAL_METHODS[byte.arg].str() + ")";
|
||||||
|
break;
|
||||||
|
case OP_BITWISE_OP:
|
||||||
|
argStr += " (" + BITWISE_SPECIAL_METHODS[byte.arg].str() + ")";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ss << argStr;
|
ss << argStr;
|
||||||
// ss << pad(argStr, 20); // may overflow
|
// ss << pad(argStr, 20); // may overflow
|
||||||
|
Loading…
x
Reference in New Issue
Block a user