Skip to content

Commit

Permalink
evaluator: Fix more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Feb 1, 2025
1 parent 506b867 commit 3095ad4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/include/pl/core/evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace pl::core {
struct Scope {
Scope(const std::shared_ptr<pl::ptrn::Pattern>& parentPattern,
std::vector<std::shared_ptr<pl::ptrn::Pattern>>* scopePatterns,
unsigned long heapSize)
size_t heapSize)
: parent(parentPattern),
scope(scopePatterns),
heapStartSize(heapSize) {}
Expand Down
10 changes: 8 additions & 2 deletions lib/source/pl/core/ast/ast_node_mathematical_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,17 @@ namespace pl::core::ast {
case Token::Operator::Slash:
if (right == 0)
err::E0002.throwError("Division by zero.", { }, this->getLocation());
return new ASTNodeLiteral(R(R(left) / R(right)));
if constexpr (std::same_as<R, bool>)
err::E0001.throwError("Cannot divide boolean values.", { }, this->getLocation());
else
return new ASTNodeLiteral(R(R(left) / R(right)));
case Token::Operator::Percent:
if (right == 0)
err::E0002.throwError("Division by zero.", { }, this->getLocation());
return new ASTNodeLiteral(R(modulus(left, right)));
if constexpr (std::same_as<R, bool>)
err::E0001.throwError("Cannot divide boolean values.", { }, this->getLocation());
else
return new ASTNodeLiteral(R(modulus(left, right)));
case Token::Operator::LeftShift:
return new ASTNodeLiteral(R(shiftLeft(left, right)));
case Token::Operator::RightShift:
Expand Down

0 comments on commit 3095ad4

Please sign in to comment.