forked from PuqiAR/Fig-TreeWalker
[VER 0.3.2-Hotfix]
[Feat] 面对对象(struct)支持,完成对其初始化解析。 [Impl] Value更换为Object,且简单类型按值存储,复杂类型为shared_ptr。 [Impl] 全局使用 Object shared_ptr
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Fig
|
||||
Ast::BlockStatement body;
|
||||
|
||||
bool isBuiltin = false;
|
||||
std::function<Object(const std::vector<Object> &)> builtin;
|
||||
std::function<std::shared_ptr<Object>(const std::vector<std::shared_ptr<Object>> &)> builtin;
|
||||
int builtinParamCount = -1;
|
||||
|
||||
std::shared_ptr<Context> closureContext;
|
||||
@@ -38,10 +38,8 @@ namespace Fig
|
||||
{
|
||||
}
|
||||
|
||||
Function(std::function<Object(const std::vector<Object> &)> fn, int argc) :
|
||||
id(nextId()), isBuiltin(true), builtin(std::move(fn)), builtinParamCount(argc)
|
||||
{
|
||||
}
|
||||
Function(std::function<std::shared_ptr<Object>(const std::vector<std::shared_ptr<Object>> &)> fn, int argc) :
|
||||
id(nextId()), isBuiltin(true), builtin(fn), builtinParamCount(argc) {}
|
||||
|
||||
// ===== Copy / Move =====
|
||||
Function(const Function &other) = default;
|
||||
|
||||
Reference in New Issue
Block a user