Compare commits
8 Commits
v0.4.0-alp
...
v0.4.1-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 21641f888e | |||
| def69e031f | |||
| 009a70fc64 | |||
| e01b4e9849 | |||
| da262a4cf1 | |||
| f76e28ee8d | |||
| a324cf17f6 | |||
| caf058dd55 |
@@ -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"
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user