Skip to content

Commit

Permalink
Refactoration for irrelevant std::move() usages.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Nov 10, 2024
1 parent 2bcef61 commit eb85162
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/n8/ast/expression/ArrayExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DynamicObject ArrayExpression::visit(SymbolTable& symbols) {
std::make_shared<std::vector<DynamicObject>>();

for(size_t i = 0; i < this->elements.size(); i++)
objects->push_back(std::move(this->elements.at(i)->visit(symbols)));
objects->push_back(this->elements.at(i)->visit(symbols));

return DynamicObject(objects);
}
28 changes: 13 additions & 15 deletions src/n8/parser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ std::shared_ptr<ASTNode> Parser::exprPrimary() {
Token address = this->consume(TokenType::OPERATOR);
expression = std::make_shared<UnaryExpression>(
std::make_shared<Token>(address),
std::move(std::string(address.getImage())),
std::string(address.getImage()),
this->expression()
);
}
Expand Down Expand Up @@ -637,9 +637,7 @@ std::shared_ptr<ASTNode> Parser::exprPrimary() {
if(!arguments.empty())
this->consume(",");

arguments.emplace_back(
std::move(this->expression())
);
arguments.emplace_back(this->expression());
}

this->consume(")");
Expand Down Expand Up @@ -675,7 +673,7 @@ std::shared_ptr<ASTNode> Parser::exprLogicOr() {
std::make_shared<Token>(address),
std::move(expression),
"||",
std::move(this->exprLogicAnd())
this->exprLogicAnd()
);
}

Expand All @@ -691,7 +689,7 @@ std::shared_ptr<ASTNode> Parser::exprLogicAnd() {
std::make_shared<Token>(address),
std::move(expression),
"&&",
std::move(this->exprBitwiseOr())
this->exprBitwiseOr()
);
}

Expand All @@ -707,7 +705,7 @@ std::shared_ptr<ASTNode> Parser::exprBitwiseOr() {
std::make_shared<Token>(address),
std::move(expression),
"|",
std::move(this->exprBitwiseXor())
this->exprBitwiseXor()
);
}

Expand All @@ -723,7 +721,7 @@ std::shared_ptr<ASTNode> Parser::exprBitwiseXor() {
std::make_shared<Token>(address),
std::move(expression),
"^",
std::move(this->exprBitwiseAnd())
this->exprBitwiseAnd()
);
}

Expand All @@ -739,7 +737,7 @@ std::shared_ptr<ASTNode> Parser::exprBitwiseAnd() {
std::make_shared<Token>(address),
std::move(expression),
"&",
std::move(this->exprNilCoalescing())
this->exprNilCoalescing()
);
}

Expand All @@ -754,7 +752,7 @@ std::shared_ptr<ASTNode> Parser::exprNilCoalescing() {
expression = std::make_shared<NilCoalescingExpression>(
std::make_shared<Token>(address),
std::move(expression),
std::move(this->exprEquality())
this->exprEquality()
);
}

Expand All @@ -774,7 +772,7 @@ std::shared_ptr<ASTNode> Parser::exprEquality() {
std::make_shared<Token>(op),
std::move(expression),
op.getImage(),
std::move(this->exprComparison())
this->exprComparison()
);
}

Expand All @@ -794,7 +792,7 @@ std::shared_ptr<ASTNode> Parser::exprComparison() {
std::make_shared<Token>(op),
std::move(expression),
op.getImage(),
std::move(this->exprShift())
this->exprShift()
);
}

Expand All @@ -811,7 +809,7 @@ std::shared_ptr<ASTNode> Parser::exprShift() {
std::make_shared<Token>(op),
std::move(expression),
op.getImage(),
std::move(this->exprTerm())
this->exprTerm()
);
}

Expand All @@ -828,7 +826,7 @@ std::shared_ptr<ASTNode> Parser::exprTerm() {
std::make_shared<Token>(op),
std::move(expression),
op.getImage(),
std::move(this->exprFactor())
this->exprFactor()
);
}

Expand All @@ -846,7 +844,7 @@ std::shared_ptr<ASTNode> Parser::exprFactor() {
std::make_shared<Token>(op),
std::move(expression),
op.getImage(),
std::move(this->exprPrimary())
this->exprPrimary()
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/n8/util/VectorMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DynamicObject vector2Object(const std::vector<double>& vec) {

#pragma omp parallel for
for(size_t i = 0; i < vec.size(); ++i)
objects[i] = std::move(DynamicObject(vec[i]));
objects[i] = DynamicObject(vec[i]);

return DynamicObject(
std::make_shared<std::vector<DynamicObject>>(std::move(objects))
Expand Down

0 comments on commit eb85162

Please sign in to comment.