diff --git a/nyan/value/number.cpp b/nyan/value/number.cpp index 475e03b..9ec4910 100644 --- a/nyan/value/number.cpp +++ b/nyan/value/number.cpp @@ -103,13 +103,13 @@ Float::Number(const IDToken &token) { template<> bool Number::is_infinite() const { - return this->value == INT_POS_INF or this->value == INT_NEG_INF; + return (this->value == INT_POS_INF or this->value == INT_NEG_INF); } template<> bool Number::is_infinite() const { - return this->value == FLOAT_POS_INF or this->value == FLOAT_NEG_INF; + return (this->value == FLOAT_POS_INF or this->value == FLOAT_NEG_INF); } @@ -144,8 +144,8 @@ void Number::apply_value(const Value &value, nyan_op operation) { applier(this->value, change.get(), operation); } else { - Float *left = dynamic_cast(this); - auto change_value = left->handle_infinity(change, operation); + Float left = static_cast(*this); + auto change_value = left.handle_infinity(change, operation); applier(this->value, change_value, nyan_op::ASSIGN); } } @@ -156,8 +156,8 @@ void Number::apply_value(const Value &value, nyan_op operation) { applier(this->value, change.get(), operation); } else { - Int *left = dynamic_cast(this); - auto change_value = left->handle_infinity(change, operation); + Int left = static_cast(*this); + auto change_value = left.handle_infinity(change, operation); applier(this->value, change_value, nyan_op::ASSIGN); } } diff --git a/test/test.nyan b/test/test.nyan index 8ed83a9..15f45ea 100644 --- a/test/test.nyan +++ b/test/test.nyan @@ -15,6 +15,8 @@ First(): FirstPatch(): member += 3 + blub += 3 + blob -= 3 Second(First): member *= 5.5