Objects Initial
This commit is contained in:
parent
0f639ba3b1
commit
94057d2a66
76 changed files with 7895 additions and 17 deletions
42
Objects/public/compiler/constants.h
Normal file
42
Objects/public/compiler/constants.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "interpreter/bytecode.h"
|
||||
#include "core/object.h"
|
||||
|
||||
namespace obj {
|
||||
namespace BCgen {
|
||||
|
||||
struct ConstObject {
|
||||
obj::Object* mObj = NULL;
|
||||
tp::alni mConstIdx = 0;
|
||||
|
||||
ConstObject();
|
||||
ConstObject(obj::Object* mObj);
|
||||
};
|
||||
|
||||
|
||||
struct ConstObjectsPool {
|
||||
tp::Map<tp::String, ConstObject*> mMethods;
|
||||
tp::Map<tp::String, ConstObject*> mStrings;
|
||||
tp::Map<tp::alni, ConstObject*> mIntegers;
|
||||
tp::Map<tp::alnf, ConstObject*> mFloats;
|
||||
ConstObject mBoolTrue;
|
||||
ConstObject mBoolFalse;
|
||||
|
||||
bool mDelete = true;
|
||||
tp::alni mTotalObjects = 0;
|
||||
|
||||
ConstObject* get(tp::alni val);
|
||||
ConstObject* get(tp::String val);
|
||||
ConstObject* get(tp::alnf val);
|
||||
ConstObject* get(bool val);
|
||||
|
||||
ConstObject* addMethod(tp::String method_id, obj::Object* method);
|
||||
ConstObject* registerObject(obj::Object* obj);
|
||||
void save(tp::Buffer<ConstData>& out);
|
||||
|
||||
~ConstObjectsPool();
|
||||
};
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue