mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
rollback
This commit is contained in:
parent
472c64323c
commit
95720b965f
@ -72,9 +72,9 @@ struct CodeObject {
|
||||
std::vector<LineInfo> lines;
|
||||
|
||||
List consts;
|
||||
small_vector<StrName, 16> varnames; // local variables
|
||||
pod_vector<StrName> varnames; // local variables
|
||||
NameDictInt varnames_inv;
|
||||
small_vector<CodeBlock, 4> blocks;
|
||||
std::vector<CodeBlock> blocks;
|
||||
NameDictInt labels;
|
||||
std::vector<FuncDecl_> func_decls;
|
||||
|
||||
@ -96,8 +96,8 @@ struct FuncDecl {
|
||||
PyObject* value; // default value
|
||||
};
|
||||
CodeObject_ code; // code object of this function
|
||||
small_vector<int, 4> args; // indices in co->varnames
|
||||
small_vector<KwArg, 4> kwargs; // indices in co->varnames
|
||||
pod_vector<int> args; // indices in co->varnames
|
||||
pod_vector<KwArg> kwargs; // indices in co->varnames
|
||||
int starred_arg = -1; // index in co->varnames, -1 if no *arg
|
||||
int starred_kwarg = -1; // index in co->varnames, -1 if no **kwarg
|
||||
bool nested = false; // whether this function is nested
|
||||
|
@ -126,7 +126,7 @@ struct Frame {
|
||||
}
|
||||
};
|
||||
|
||||
using CallstackContainer = small_vector<Frame, 8>;
|
||||
using CallstackContainer = std::vector<Frame>;
|
||||
|
||||
struct FrameId{
|
||||
CallstackContainer* data;
|
||||
|
@ -104,7 +104,7 @@ struct Lexer {
|
||||
const char* curr_char;
|
||||
int current_line = 1;
|
||||
std::vector<Token> nexts;
|
||||
stack_no_copy<int, small_vector<int, 6>> indents;
|
||||
stack_no_copy<int, pod_vector<int>> indents;
|
||||
int brackets_level = 0;
|
||||
bool used = false;
|
||||
|
||||
|
13
src/vm.cpp
13
src/vm.cpp
@ -69,17 +69,12 @@ namespace pkpy{
|
||||
VM::VM(bool enable_os) : heap(this), enable_os(enable_os) {
|
||||
this->vm = this;
|
||||
this->_c.error = nullptr;
|
||||
_stdout = [](const char* buf, int size) {
|
||||
std::cout.write(buf, size);
|
||||
};
|
||||
_stderr = [](const char* buf, int size) {
|
||||
std::cerr.write(buf, size);
|
||||
};
|
||||
this->callstack.reserve(8);
|
||||
_stdout = [](const char* buf, int size) { std::cout.write(buf, size); };
|
||||
_stderr = [](const char* buf, int size) { std::cerr.write(buf, size); };
|
||||
_main = nullptr;
|
||||
_last_exception = nullptr;
|
||||
_import_handler = [](const char* name_p, int name_size, int* out_size) -> unsigned char*{
|
||||
return nullptr;
|
||||
};
|
||||
_import_handler = [](const char* name_p, int name_size, int* out_size) -> unsigned char*{ return nullptr; };
|
||||
init_builtin_types();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user