Unary operation for literals.

This commit is contained in:
chriseth 2019-05-02 14:25:15 +02:00
parent 8a3006a0fa
commit 4069b19734
2 changed files with 11 additions and 0 deletions

View File

@ -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, "");

View File

@ -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;