This commit is contained in:
2026-01-19 23:10:09 +08:00
parent 1a66d45204
commit 2839c0daff
17 changed files with 2274 additions and 46 deletions

View File

@@ -106,6 +106,7 @@ public:
};
// Forward declarations
class Chunk;
struct FunctionDecl;
class ClassValue;
class InstanceValue;
@@ -116,15 +117,18 @@ public:
std::vector<std::pair<std::string, std::string>> parameters;
std::string return_type;
std::shared_ptr<FunctionDecl> declaration;
std::shared_ptr<Chunk> chunk;
NativeFunction native_func;
bool is_native;
std::shared_ptr<InstanceValue> bound_instance;
// Script function
FunctionValue(std::string name, std::shared_ptr<FunctionDecl> declaration,
std::shared_ptr<Chunk> chunk = nullptr,
std::shared_ptr<InstanceValue> bound_instance = nullptr)
: name(std::move(name)), declaration(std::move(declaration)),
is_native(false), bound_instance(std::move(bound_instance)) {}
chunk(std::move(chunk)), is_native(false),
bound_instance(std::move(bound_instance)) {}
// Native function
FunctionValue(std::string name, NativeFunction func)