From f68c09272b5dfbcf9111c8a5e2c37267a5eafe60 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 2 May 2019 18:28:33 +0200 Subject: [PATCH] Simple tuple expressions. --- .../codegen/ir/IRGeneratorForStatements.cpp | 15 +++++++++++++++ libsolidity/codegen/ir/IRGeneratorForStatements.h | 1 + 2 files changed, 16 insertions(+) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 8425c591c..c31449239 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -131,6 +131,21 @@ bool IRGeneratorForStatements::visit(Assignment const& _assignment) return false; } +bool IRGeneratorForStatements::visit(TupleExpression const& _tuple) +{ + if (_tuple.isInlineArray()) + solUnimplementedAssert(false, ""); + else + { + solUnimplementedAssert(!_tuple.annotation().lValueRequested, ""); + solUnimplementedAssert(_tuple.components().size() == 1, ""); + solAssert(_tuple.components().front(), ""); + _tuple.components().front()->accept(*this); + defineExpression(_tuple) << m_context.variable(*_tuple.components().front()) << "\n"; + } + return false; +} + bool IRGeneratorForStatements::visit(ForStatement const& _for) { m_code << "for {\n"; diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.h b/libsolidity/codegen/ir/IRGeneratorForStatements.h index 586d5241b..b57ffa8e1 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.h +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.h @@ -47,6 +47,7 @@ public: void endVisit(VariableDeclarationStatement const& _variableDeclaration) override; bool visit(Assignment const& _assignment) override; + bool visit(TupleExpression const& _tuple) override; bool visit(ForStatement const& _forStatement) override; bool visit(Continue const& _continueStatement) override; bool visit(Break const& _breakStatement) override;