[Fix] 修复无法调用类函数的问题

[Feat] Context merge功能
[Feat] VSCode 拓展现已更为 fig-vscode.
This commit is contained in:
2025-12-23 01:15:35 +08:00
parent 50a4705551
commit 6226059adc
28 changed files with 3682 additions and 264 deletions

View File

@@ -46,6 +46,16 @@ namespace Fig
return scopeName;
}
void merge(const Context& c)
{
varTypes.insert(c.varTypes.begin(), c.varTypes.end());
variables.insert(c.variables.begin(), c.variables.end());
ams.insert(c.ams.begin(), c.ams.end());
functions.insert(c.functions.begin(), c.functions.end());
functionNames.insert(c.functionNames.begin(), c.functionNames.end());
structTypeNames.insert(c.structTypeNames.begin(), c.structTypeNames.end());
}
std::optional<ObjectPtr> get(const FString &name)
{
auto it = variables.find(name);

View File

@@ -15,6 +15,7 @@ namespace Fig
class EvaluatorError final : public AddressableError
{
public:
const char* errorName = errName;
virtual FString toString() const override
{
std::string msg = std::format("[Eve: {}] {} in [{}] {}", errName, std::string(this->message.begin(), this->message.end()), this->src_loc.file_name(), this->src_loc.function_name());
@@ -27,6 +28,11 @@ namespace Fig
AddressableError(_msg, aai.line, aai.column, loc)
{
}
virtual FString getErrorType() const override
{
return FString("[Eval]" + std::string(errorName));
}
};
struct StatementResult
{