RIP tp::Strings
This commit is contained in:
parent
fa2d0aaa92
commit
1756ca026d
90 changed files with 419 additions and 1475 deletions
|
|
@ -60,7 +60,7 @@ ConstObject* ConstObjectsPool::get(tp::alni val) {
|
|||
return const_obj;
|
||||
}
|
||||
|
||||
ConstObject* ConstObjectsPool::get(tp::String val) {
|
||||
ConstObject* ConstObjectsPool::get(const std::string& val) {
|
||||
auto idx = mStrings.presents(val);
|
||||
ConstObject* const_obj = NULL;
|
||||
if (idx) {
|
||||
|
|
@ -100,7 +100,7 @@ ConstObject* ConstObjectsPool::get(bool val) {
|
|||
}
|
||||
}
|
||||
|
||||
ConstObject* ConstObjectsPool::addMethod(tp::String method_id, obj::Object* method) {
|
||||
ConstObject* ConstObjectsPool::addMethod(const std::string& method_id, obj::Object* method) {
|
||||
ASSERT(NDO_CAST(MethodObject, method) && "Object is not a method object");
|
||||
ASSERT(!mMethods.presents(method_id) && "Method Redefinition");
|
||||
auto out = registerObject(method);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using namespace BCgen;
|
|||
Expression::Expression(Type type) :
|
||||
mType(type) {}
|
||||
|
||||
ExpressionChild* Expression::ExprChild(const tp::String& id) { return new ExpressionChild(this, id); }
|
||||
ExpressionChild* Expression::ExprChild(const std::string& id) { return new ExpressionChild(this, id); }
|
||||
|
||||
ExpressionCall* Expression::ExprCall(ExpressionList* args) { return new ExpressionCall(this, args); }
|
||||
|
||||
|
|
@ -46,13 +46,13 @@ ExpressionList::~ExpressionList() {
|
|||
}
|
||||
}
|
||||
|
||||
ExpressionNew::ExpressionNew(const tp::String& type) :
|
||||
ExpressionNew::ExpressionNew(const std::string& type) :
|
||||
Expression(Type::NEW),
|
||||
mNewType(type) {}
|
||||
|
||||
ExpressionNew::~ExpressionNew() = default;
|
||||
|
||||
ExpressionLocal::ExpressionLocal(const tp::String& id) :
|
||||
ExpressionLocal::ExpressionLocal(const std::string& id) :
|
||||
Expression(Type::LOCAL),
|
||||
mLocalId(id) {}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ ExpressionLocal::~ExpressionLocal() = default;
|
|||
ExpressionSelf::ExpressionSelf() :
|
||||
Expression(Type::SELF) {}
|
||||
|
||||
ExpressionChild::ExpressionChild(Expression* mParent, const tp::String& id) :
|
||||
ExpressionChild::ExpressionChild(Expression* mParent, const std::string& id) :
|
||||
Expression(Type::CHILD),
|
||||
mParent(mParent),
|
||||
mLocalId(id) {}
|
||||
|
|
@ -79,13 +79,13 @@ ExpressionArithmetics::~ExpressionArithmetics() {
|
|||
delete mRight;
|
||||
}
|
||||
|
||||
ExpressionFunc::ExpressionFunc(const tp::String& id) :
|
||||
ExpressionFunc::ExpressionFunc(const std::string& id) :
|
||||
Expression(Type::FUNC),
|
||||
mFuncId(id) {}
|
||||
|
||||
ExpressionFunc::~ExpressionFunc() = default;
|
||||
|
||||
ExpressionConst::ExpressionConst(const tp::String& val) :
|
||||
ExpressionConst::ExpressionConst(const std::string& val) :
|
||||
Expression(Type::CONST_EXPR),
|
||||
mConstType(STR),
|
||||
str(val) {}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
#include "primitives/methodobject.h"
|
||||
#include "primitives/primitives.h"
|
||||
|
||||
#include "Logging.hpp"
|
||||
|
||||
#include "parser/parser.h"
|
||||
|
||||
using namespace obj;
|
||||
|
|
@ -27,7 +25,7 @@ void obj::BCgen::Genereate(ByteCode& out, StatementScope* body) {
|
|||
root.generateByteCode(out);
|
||||
}
|
||||
|
||||
ConstObject* FunctionDefinition::defineLocal(tp::String id) {
|
||||
ConstObject* FunctionDefinition::defineLocal(const std::string& id) {
|
||||
auto idx = mLocals.presents(id);
|
||||
// RelAssert(!idx && "Local Redefinition");
|
||||
auto const_str_id = mConstants.get(id);
|
||||
|
|
@ -35,7 +33,7 @@ ConstObject* FunctionDefinition::defineLocal(tp::String id) {
|
|||
return const_str_id;
|
||||
}
|
||||
|
||||
FunctionDefinition::FunctionDefinition(tp::String function_id, tp::Buffer<tp::String> args, FunctionDefinition* prnt) {
|
||||
FunctionDefinition::FunctionDefinition(const std::string& function_id, tp::Buffer<std::string> args, FunctionDefinition* prnt) {
|
||||
mFunctionId = function_id;
|
||||
inst(Instruction(OpCode::SAVE_ARGS, args.size(), 1));
|
||||
for (auto id : args) {
|
||||
|
|
@ -190,7 +188,7 @@ void FunctionDefinition::EvalStatement(Statement* stm) {
|
|||
|
||||
} else {
|
||||
|
||||
tp::String type;
|
||||
std::string type;
|
||||
switch (stm_local_def->mConstExpr->mConstType) {
|
||||
case ExpressionConst::BOOL:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
using namespace obj;
|
||||
using namespace BCgen;
|
||||
|
||||
StatementFuncDef::StatementFuncDef(const tp::String& function_id) :
|
||||
StatementFuncDef::StatementFuncDef(const std::string& function_id) :
|
||||
Statement(Type::DEF_FUNC) {
|
||||
mFunctionId = function_id;
|
||||
}
|
||||
|
||||
StatementFuncDef::~StatementFuncDef() { delete mStatements; }
|
||||
|
||||
StatementLocalDef::StatementLocalDef(const tp::String& id, Expression* value) :
|
||||
StatementLocalDef::StatementLocalDef(const std::string& id, Expression* value) :
|
||||
mLocalId(id),
|
||||
Statement(Type::DEF_LOCAL) {
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ StatementIgnore::StatementIgnore(Expression* expr) :
|
|||
|
||||
StatementIgnore::~StatementIgnore() { delete mExpr; }
|
||||
|
||||
StatementClassDef::StatementClassDef(const tp::String& class_id, StatementScope* scope) :
|
||||
StatementClassDef::StatementClassDef(const std::string& class_id, StatementScope* scope) :
|
||||
Statement(Type::CLASS_DEF) {
|
||||
mClassId = class_id;
|
||||
mScope = scope;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue