mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-07 02:30:17 +00:00
up
This commit is contained in:
parent
22e909d7e1
commit
a187e5bcdb
@ -60,6 +60,7 @@ struct CodeObject {
|
||||
std::set<StrName> global_names;
|
||||
std::vector<CodeBlock> blocks = { CodeBlock{NO_BLOCK, -1} };
|
||||
std::map<StrName, int> labels;
|
||||
std::vector<FunctionDecl> functions;
|
||||
|
||||
// may be.. just use a large NameDict?
|
||||
uint32_t perfect_locals_capacity = 2;
|
||||
|
||||
12
src/obj.h
12
src/obj.h
@ -24,7 +24,7 @@ struct NativeFunc {
|
||||
PyObject* operator()(VM* vm, Args& args) const;
|
||||
};
|
||||
|
||||
struct Function {
|
||||
struct FunctionDecl {
|
||||
StrName name;
|
||||
CodeObject_ code;
|
||||
std::vector<StrName> args;
|
||||
@ -32,10 +32,6 @@ struct Function {
|
||||
NameDict kwargs; // empty if no k=v
|
||||
std::vector<StrName> kwargs_order;
|
||||
|
||||
// runtime settings
|
||||
PyObject* _module = nullptr;
|
||||
NameDict_ _closure = nullptr;
|
||||
|
||||
bool has_name(StrName val) const {
|
||||
bool _0 = std::find(args.begin(), args.end(), val) != args.end();
|
||||
bool _1 = starred_arg == val;
|
||||
@ -44,6 +40,12 @@ struct Function {
|
||||
}
|
||||
};
|
||||
|
||||
struct Function{
|
||||
const FunctionDecl* decl;
|
||||
PyObject* _module = nullptr;
|
||||
NameDict_ _closure = nullptr;
|
||||
};
|
||||
|
||||
struct BoundMethod {
|
||||
PyObject* obj;
|
||||
PyObject* method;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user