Skip to content

Commit

Permalink
Used shared pointers instead of unique pointers on source file implem…
Browse files Browse the repository at this point in the history
…entations.
  • Loading branch information
nthnn committed Oct 26, 2024
1 parent 82b5288 commit 56d7b4a
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 204 deletions.
2 changes: 1 addition & 1 deletion src/zhivo/ast/expression/BinaryExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ DynamicObject BinaryExpression::visit(SymbolTable& symbols) {
);

DynamicObject rValue = this->right->visit(symbols);
std::unique_ptr<DynamicObject> rValuePtr = std::make_unique<DynamicObject>(rValue);
std::shared_ptr<DynamicObject> rValuePtr = std::make_shared<DynamicObject>(rValue);

arrayVal.setArrayElement(
std::move(this->address),
Expand Down
2 changes: 1 addition & 1 deletion src/zhivo/ast/expression/VariableDeclarationExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ DynamicObject VariableDeclarationExpression::visit(SymbolTable& symbols) {
NativeFunction VariableDeclarationExpression::loadNativeFunction(
std::string& libName,
std::string& funcName,
std::unique_ptr<Token> address
std::shared_ptr<Token> address
) {
void* handle;
std::string library = std::string(libName.c_str());
Expand Down
4 changes: 2 additions & 2 deletions src/zhivo/core/DynamicObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ bool DynamicObject::booleanEquivalent() {
}

void DynamicObject::setArrayElement(
std::unique_ptr<Token> reference,
std::shared_ptr<Token> reference,
size_t index,
std::unique_ptr<DynamicObject> object
std::shared_ptr<DynamicObject> object
) {
if(!this->isArray())
#ifdef _MSC_VER
Expand Down
2 changes: 1 addition & 1 deletion src/zhivo/core/SymbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SymbolTable& SymbolTable::operator=(const SymbolTable& other) {
}

DynamicObject SymbolTable::getSymbol(
std::unique_ptr<Token> reference,
std::shared_ptr<Token> reference,
const std::string& name
) {
if(this->hasSymbol(name))
Expand Down
Loading

0 comments on commit 56d7b4a

Please sign in to comment.