8 Commits

Author SHA1 Message Date
21641f888e 恢复原来的构建逻辑 2026-01-19 17:33:52 +08:00
def69e031f qswl x3 2026-01-19 17:26:46 +08:00
009a70fc64 气死我了x2 2026-01-19 17:24:29 +08:00
e01b4e9849 气死我了 2026-01-19 17:19:12 +08:00
da262a4cf1 尝试修复 build.yml 版本构建 2026-01-19 17:09:44 +08:00
f76e28ee8d 修改 build action 2026-01-19 16:57:57 +08:00
a324cf17f6 尝试修复windows构建版本获取问题,代码是ds写的。我不会actions 2026-01-19 16:27:14 +08:00
caf058dd55 [VER] v0.4.1-alpha
[Fix] 修复struct定义创建instanceCtx时拷贝类方法错误的Bug,表现在同一类的2个不同实例内置函数一样的问题
      (即 addr A != addr B, addr A.method == addr B.method)
      修复后为 (addr A != addr B, addr A.method != addr B.method)
      方法的closureContext指向instance的Context
      修复后 std.time可以正常使用
2026-01-19 16:10:12 +08:00
2 changed files with 35 additions and 10 deletions

View File

@@ -4,7 +4,7 @@
#include <cstdint> #include <cstdint>
#include <string_view> #include <string_view>
#define __FCORE_VERSION "0.4.0-alpha" #define __FCORE_VERSION "0.4.1-alpha"
#if defined(_WIN32) #if defined(_WIN32)
#define __FCORE_PLATFORM "Windows" #define __FCORE_PLATFORM "Windows"

View File

@@ -984,17 +984,42 @@ namespace Fig
} }
} }
} }
instanceCtx->merge(*structT.defContext); // instanceCtx->merge(*structT.defContext);
for (auto &[id, fn] : instanceCtx->getFunctions()) // for (auto &[id, fn] : instanceCtx->getFunctions())
// {
// instanceCtx->_update(*instanceCtx->getFunctionName(id),
// std::make_shared<Object>(Function(fn.paras,
// fn.retType,
// fn.body,
// instanceCtx) // change its closureContext to
// // struct instance's context
// ));
// }
ContextPtr stDefCtx = structT.defContext;
// load struct method
for (auto &[id, fn] : stDefCtx->getFunctions())
{ {
instanceCtx->_update(*instanceCtx->getFunctionName(id), auto funcNameOpt = stDefCtx->getFunctionName(id);
std::make_shared<Object>(Function(fn.paras, assert(funcNameOpt.has_value());
fn.retType,
fn.body, const FString &funcName = *funcNameOpt;
instanceCtx) // change its closureContext to auto funcSlot = stDefCtx->get(funcName);
// struct instance's context
)); instanceCtx->def(
funcName,
ValueType::Function,
funcSlot->am,
std::make_shared<Object>(Function(
fn.paras,
fn.retType,
fn.body,
instanceCtx
))
);
} }
return std::make_shared<Object>(StructInstance(structT.type, instanceCtx)); return std::make_shared<Object>(StructInstance(structT.type, instanceCtx));
} }