refactor(furvm): improve functions
Define native functions inside the module instead of the function itself (native functions hold only the key to the definition), introduce private functions, add parameter count to function and fix some bugs. Closes: #20 Closes: #25
This commit is contained in:
@@ -12,9 +12,10 @@ std::ostream& mod::serialize(std::ostream& os) const {
|
||||
detail::serialize(os, std::uint32_t(0)); // version
|
||||
|
||||
detail::serialize(os, function_id(m_functionMap.size()));
|
||||
for (const auto& [name, id] : m_functionMap) {
|
||||
detail::serialize(os, name);
|
||||
function_h func = m_functions.at(id);
|
||||
for (auto* pair : m_functions) {
|
||||
function_h func = { pair };
|
||||
bool isPublic = m_publicFunctions.find(func->name()) != m_publicFunctions.end();
|
||||
detail::serialize(os, isPublic ? func->name() : ""); // private functions have empty names
|
||||
detail::serialize(os, std::uint8_t(func->type()));
|
||||
switch (func->type()) {
|
||||
case function_t::Normal: {
|
||||
|
||||
Reference in New Issue
Block a user