new object creation interface

This commit is contained in:
IlyaShurupov 2024-03-25 10:25:25 +03:00
parent c737f41d8a
commit e937d189df
23 changed files with 103 additions and 84 deletions

View file

@ -127,7 +127,7 @@ void FunctionDefinition::EvalStatement(Statement* stm) {
mLocals.put(func.mFunctionId, mConstants.get(func.mFunctionId));
// create and register const func object
auto function_obj = objects_api::cast<MethodObject>(NDO->create("method"));
auto function_obj = objects_api::create<MethodObject>();
auto method_const_obj = mConstants.addMethod(func.mFunctionId, function_obj);
for (auto child_stm : stm_func_def->mStatements->mStatements) {
@ -155,7 +155,7 @@ void FunctionDefinition::EvalStatement(Statement* stm) {
mLocals.put(func.mFunctionId, mConstants.get(func.mFunctionId));
// create and register const func object
auto function_obj = objects_api::cast<MethodObject>(NDO->create("method"));
auto function_obj = objects_api::create<MethodObject>();
auto method_const_obj = mConstants.addMethod(func.mFunctionId, function_obj);
// compile function