mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
up
This commit is contained in:
parent
d45e348340
commit
998e3e4249
@ -162,6 +162,8 @@ All kinds of contributions are welcome.
|
|||||||
- any suggestions
|
- any suggestions
|
||||||
- any questions
|
- any questions
|
||||||
|
|
||||||
|
Check our [Coding Style Guide](https://pocketpy.dev/coding_style_guide/) if you want to contribute C++ code.
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
||||||
+ [cpython](https://github.com/python/cpython)
|
+ [cpython](https://github.com/python/cpython)
|
||||||
|
@ -254,12 +254,14 @@ struct Frame {
|
|||||||
if(_next_ip >= co->codes.size()){
|
if(_next_ip >= co->codes.size()){
|
||||||
while(i>=0){
|
while(i>=0){
|
||||||
if(co->blocks[i].type == FOR_LOOP) pop();
|
if(co->blocks[i].type == FOR_LOOP) pop();
|
||||||
|
else if(co->blocks[i].type == TRY_EXCEPT) on_try_block_exit();
|
||||||
i = co->blocks[i].parent;
|
i = co->blocks[i].parent;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
const Bytecode& next = co->codes[target];
|
const Bytecode& next = co->codes[target];
|
||||||
while(i>=0 && i!=next.block){
|
while(i>=0 && i!=next.block){
|
||||||
if(co->blocks[i].type == FOR_LOOP) pop();
|
if(co->blocks[i].type == FOR_LOOP) pop();
|
||||||
|
else if(co->blocks[i].type == TRY_EXCEPT) on_try_block_exit();
|
||||||
i = co->blocks[i].parent;
|
i = co->blocks[i].parent;
|
||||||
}
|
}
|
||||||
if(i!=next.block) throw std::runtime_error("invalid jump");
|
if(i!=next.block) throw std::runtime_error("invalid jump");
|
||||||
|
@ -35,11 +35,8 @@
|
|||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PK_VERSION "0.8.2"
|
#define PK_VERSION "0.8.3"
|
||||||
|
|
||||||
typedef int64_t i64;
|
typedef int64_t i64;
|
||||||
typedef double f64;
|
typedef double f64;
|
||||||
#define DUMMY_VAL (i64)0
|
#define DUMMY_VAL (i64)0
|
||||||
|
|
||||||
#define CPP_LAMBDA(x) ([](VM* vm, const pkpy::Args& args) { return x; })
|
|
||||||
#define CPP_NOT_IMPLEMENTED() ([](VM* vm, const pkpy::Args& args) { vm->NotImplementedError(); return vm->None; })
|
|
@ -5,6 +5,9 @@
|
|||||||
#include "repl.h"
|
#include "repl.h"
|
||||||
#include "iter.h"
|
#include "iter.h"
|
||||||
|
|
||||||
|
#define CPP_LAMBDA(x) ([](VM* vm, const pkpy::Args& args) { return x; })
|
||||||
|
#define CPP_NOT_IMPLEMENTED() ([](VM* vm, const pkpy::Args& args) { vm->NotImplementedError(); return vm->None; })
|
||||||
|
|
||||||
_Code VM::compile(_Str source, _Str filename, CompileMode mode) {
|
_Code VM::compile(_Str source, _Str filename, CompileMode mode) {
|
||||||
Compiler compiler(this, source.c_str(), filename, mode);
|
Compiler compiler(this, source.c_str(), filename, mode);
|
||||||
try{
|
try{
|
||||||
|
2
src/vm.h
2
src/vm.h
@ -253,7 +253,7 @@ class VM {
|
|||||||
PyIter_AS_C(tmp)->var = var;
|
PyIter_AS_C(tmp)->var = var;
|
||||||
frame->push(std::move(tmp));
|
frame->push(std::move(tmp));
|
||||||
}else{
|
}else{
|
||||||
TypeError("'" + OBJ_TP_NAME(obj) + "' object is not iterable");
|
TypeError(OBJ_TP_NAME(obj).escape(true) + " object is not iterable");
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case OP_FOR_ITER:
|
case OP_FOR_ITER:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user