diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 53c0586ea..6bc4538f1 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -189,6 +189,16 @@ void IRGeneratorForStatements::endVisit(Return const& _return) m_code << "return_flag := 0\n" << "break\n"; } +void IRGeneratorForStatements::endVisit(UnaryOperation const& _unaryOperation) +{ + if (_unaryOperation.annotation().type->category() == Type::Category::RationalNumber) + defineExpression(_unaryOperation) << + formatNumber(_unaryOperation.annotation().type->literalValue(nullptr)) << + "\n"; + else + solUnimplementedAssert(false, ""); +} + void IRGeneratorForStatements::endVisit(BinaryOperation const& _binOp) { solAssert(!!_binOp.annotation().commonType, ""); diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.h b/libsolidity/codegen/ir/IRGeneratorForStatements.h index f68e9042f..af5dd89a2 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.h +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.h @@ -51,6 +51,7 @@ public: bool visit(Continue const& _continueStatement) override; bool visit(Break const& _breakStatement) override; void endVisit(Return const& _return) override; + void endVisit(UnaryOperation const& _unaryOperation) override; void endVisit(BinaryOperation const& _binOp) override; void endVisit(FunctionCall const& _funCall) override; bool visit(InlineAssembly const& _inlineAsm) override;