forked from PuqiAR/Fig-TreeWalker
[Fix] 修复struct内部函数无法访问内部成员的问题
[Feat] 拓展构建
This commit is contained in:
@@ -56,6 +56,11 @@ namespace Fig
|
||||
structTypeNames.insert(c.structTypeNames.begin(), c.structTypeNames.end());
|
||||
}
|
||||
|
||||
std::unordered_map<size_t, Function> getFunctions() const
|
||||
{
|
||||
return functions;
|
||||
}
|
||||
|
||||
std::optional<ObjectPtr> get(const FString &name)
|
||||
{
|
||||
auto it = variables.find(name);
|
||||
@@ -125,6 +130,21 @@ namespace Fig
|
||||
throw RuntimeError(FStringView(std::format("Variable '{}' not defined", name.toBasicString())));
|
||||
}
|
||||
}
|
||||
void _update(const FString &name, const Object &value)
|
||||
{
|
||||
if (variables.contains(name))
|
||||
{
|
||||
variables[name] = std::make_shared<Object>(value);
|
||||
}
|
||||
else if (parent != nullptr)
|
||||
{
|
||||
parent->set(name, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw RuntimeError(FStringView(std::format("Variable '{}' not defined", name.toBasicString())));
|
||||
}
|
||||
}
|
||||
void def(const FString &name, const TypeInfo &ti, AccessModifier am, const ObjectPtr &value = Object::getNullInstance())
|
||||
{
|
||||
if (containsInThisScope(name))
|
||||
|
||||
Reference in New Issue
Block a user