RIP tp::Strings

This commit is contained in:
IlyaShurupov 2024-03-22 14:44:26 +03:00 committed by Ilya Shurupov
parent fa2d0aaa92
commit 1756ca026d
90 changed files with 419 additions and 1475 deletions

View file

@ -7,7 +7,7 @@
#include "primitives/stringobject.h"
#include "Buffer.hpp"
#include "Strings.hpp"
#include <string>
namespace obj {

View file

@ -17,15 +17,15 @@ namespace obj {
struct CallFrame {
enum { CALL_DEPTH = 1024 };
obj::Object* mSelf = NULL;
obj::MethodObject* mMethod = NULL;
obj::Object* mSelf = nullptr;
obj::MethodObject* mMethod = nullptr;
tp::ualni mIp = 0;
};
void enter(const CallFrame& frame);
void leave();
ByteCode* getBytecode();
tp::halni len() const;
[[nodiscard]] tp::halni len() const;
tp::ConstSizeBuffer<CallFrame, CallFrame::CALL_DEPTH> mStack;
};

View file

@ -10,13 +10,13 @@ namespace obj {
ScopeStack mScopeStack;
CallStack mCallStack;
obj::Object* mLastParent = NULL;
obj::Object* mLastParent = nullptr;
bool mIsTypeMethod = false;
const TypeMethod* mTypeMethod = NULL;
const TypeMethod* mTypeMethod = nullptr;
typedef struct { obj::Object* obj; tp::String id; } GlobalDef;
typedef struct { obj::Object* obj; std::string id; } GlobalDef;
void exec(obj::MethodObject* method, obj::ClassObject* self = NULL, obj::DictObject* globals = NULL, tp::InitialierList<GlobalDef> globals2 = {});
void exec(obj::MethodObject* method, obj::ClassObject* self = nullptr, obj::DictObject* globals = nullptr, tp::InitialierList<GlobalDef> globals2 = {});
void stepBytecode();
void stepBytecodeIn();
@ -24,6 +24,6 @@ namespace obj {
bool finished();
void execAll(obj::MethodObject* method, obj::ClassObject* self = NULL, obj::DictObject* globals = NULL, tp::InitialierList<GlobalDef> globals2 = {});
void execAll(obj::MethodObject* method, obj::ClassObject* self = nullptr, obj::DictObject* globals = nullptr, tp::InitialierList<GlobalDef> globals2 = {});
};
};

View file

@ -6,7 +6,7 @@
namespace obj {
struct Scope {
typedef tp::Map<tp::String, obj::Object*> ObjDict;
typedef tp::Map<std::string, obj::Object*> ObjDict;
typedef tp::List<obj::Object*> ObjList;
ObjDict mLocals;
@ -31,16 +31,16 @@ namespace obj {
ScopeStack();
void enterScope(bool aChildReachable);
void leaveScope();
void addLocal(obj::Object* local, tp::String id);
void addLocal(obj::Object* local, const std::string& id);
void addTemp(obj::Object* tmp);
void popTemp();
void addTempReturn(obj::Object* ret);
obj::Object* getLocal(tp::String& str);
obj::Object* getLocal(const std::string& str);
Scope* getCurrentScope();
~ScopeStack();
private:
obj::Object* getLocalUtil(Scope& scope, tp::String* id);
obj::Object* getLocalUtil(Scope& scope, const std::string& id);
};
};