mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-07 10:40:16 +00:00
up
This commit is contained in:
parent
c1485392cf
commit
6791c0784a
@ -838,7 +838,7 @@ __LISTCOMP:
|
||||
EXPR_TUPLE();
|
||||
consumeEndStatement();
|
||||
}
|
||||
emit(OP_RETURN_VALUE);
|
||||
emit(OP_RETURN_VALUE, -1, true);
|
||||
} else if (match(TK("if"))) {
|
||||
compileIfStatement();
|
||||
} else if (match(TK("while"))) {
|
||||
|
||||
@ -588,6 +588,15 @@ void __addModuleMath(VM* vm){
|
||||
});
|
||||
}
|
||||
|
||||
void __addModuleDis(VM* vm){
|
||||
PyVar mod = vm->new_module("dis");
|
||||
vm->bindFunc<1>(mod, "dis", [](VM* vm, const pkpy::ArgList& args) {
|
||||
_Code code = vm->PyFunction_AS_C(args[0])->code;
|
||||
(*vm->_stdout) << vm->disassemble(code);
|
||||
return vm->None;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#define PY_CLASS(mod, name) inline static PyVar _tp(VM* vm) { return vm->_modules[#mod]->attribs[#name]; }
|
||||
|
||||
@ -790,6 +799,7 @@ extern "C" {
|
||||
__addModuleJson(vm);
|
||||
__addModuleMath(vm);
|
||||
__addModuleRe(vm);
|
||||
__addModuleDis(vm);
|
||||
|
||||
// add builtins | no exception handler | must succeed
|
||||
_Code code = vm->compile(__BUILTINS_CODE, "<builtins>", EXEC_MODE);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user