remove initializer callbacks from method object
This commit is contained in:
parent
acaa086943
commit
add66e6cac
3 changed files with 18 additions and 27 deletions
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "compiler/Functions.hpp"
|
||||
|
||||
#include "primitives/PrimitiveObjects.hpp"
|
||||
#include "core/ScriptSection.hpp"
|
||||
|
||||
using namespace tp;
|
||||
using namespace obj;
|
||||
|
|
@ -20,6 +20,7 @@ static void defineTypes() {
|
|||
objects_api::define(&ColorObject::TypeData);
|
||||
objects_api::define(&InterpreterObject::TypeData);
|
||||
objects_api::define(&TypeObject::TypeData);
|
||||
objects_api::define(&MethodObject::TypeData);
|
||||
}
|
||||
|
||||
static void defineGroups() {
|
||||
|
|
@ -34,13 +35,14 @@ static void defineGroups() {
|
|||
objects_api::addTypeToGroup(&EnumObject::TypeData, { "Primitives" });
|
||||
objects_api::addTypeToGroup(&ClassObject::TypeData, { "Primitives" });
|
||||
objects_api::addTypeToGroup(&ColorObject::TypeData, { "Primitives" });
|
||||
objects_api::addTypeToGroup(&MethodObject::TypeData, { "Primitives" });
|
||||
objects_api::addTypeToGroup(&InterpreterObject::TypeData, { "scripting" });
|
||||
}
|
||||
|
||||
static bool init(const ModuleManifest*) {
|
||||
objects_api::initialize();
|
||||
|
||||
MethodObject::Initialize();
|
||||
ScriptSection::initialize();
|
||||
|
||||
defineTypes();
|
||||
defineGroups();
|
||||
|
|
@ -49,7 +51,7 @@ static bool init(const ModuleManifest*) {
|
|||
}
|
||||
|
||||
static void deinit(const ModuleManifest*) {
|
||||
MethodObject::UnInitialize();
|
||||
ScriptSection::uninitialize();
|
||||
|
||||
objects_api::finalize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,19 +6,6 @@
|
|||
using namespace tp;
|
||||
using namespace obj;
|
||||
|
||||
struct ObjectType MethodObject::TypeData = {
|
||||
.base = nullptr,
|
||||
.constructor = (object_constructor) MethodObject::constructor,
|
||||
.destructor = (object_destructor) MethodObject::destructor,
|
||||
.copy = (object_copy) MethodObject::copy,
|
||||
.size = sizeof(MethodObject),
|
||||
.name = "method",
|
||||
.conversions = nullptr,
|
||||
.save_size = (object_save_size) MethodObject::save_size,
|
||||
.save = (object_save) MethodObject::save,
|
||||
.load = (object_load) MethodObject::load,
|
||||
};
|
||||
|
||||
void MethodObject::constructor(MethodObject* self) {
|
||||
self->mScript = obj::ScriptSection::globalHandle()->createScript();
|
||||
}
|
||||
|
|
@ -49,14 +36,6 @@ void MethodObject::load(ArchiverIn& file_self, obj::MethodObject* self) {
|
|||
self->mScript = script_section->get_scritp_from_file_adress(script_table_file_address);
|
||||
}
|
||||
|
||||
void MethodObject::Initialize() {
|
||||
obj::ScriptSection::initialize();
|
||||
objects_api::define(&MethodObject::TypeData);
|
||||
objects_api::addTypeToGroup(&MethodObject::TypeData, { "Primitives" });
|
||||
}
|
||||
|
||||
void MethodObject::UnInitialize() { obj::ScriptSection::uninitialize(); }
|
||||
|
||||
void MethodObject::compile() { Compile(this); }
|
||||
|
||||
MethodObject* MethodObject::create(const std::string& script) {
|
||||
|
|
@ -65,3 +44,16 @@ MethodObject* MethodObject::create(const std::string& script) {
|
|||
out->compile();
|
||||
return out;
|
||||
}
|
||||
|
||||
struct ObjectType MethodObject::TypeData = {
|
||||
.base = nullptr,
|
||||
.constructor = (object_constructor) MethodObject::constructor,
|
||||
.destructor = (object_destructor) MethodObject::destructor,
|
||||
.copy = (object_copy) MethodObject::copy,
|
||||
.size = sizeof(MethodObject),
|
||||
.name = "method",
|
||||
.conversions = nullptr,
|
||||
.save_size = (object_save_size) MethodObject::save_size,
|
||||
.save = (object_save) MethodObject::save,
|
||||
.load = (object_load) MethodObject::load,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue