diff options
author | RJ Catalano <catalanor0220@gmail.com> | 2016-01-12 04:25:59 +0800 |
---|---|---|
committer | RJ Catalano <catalanor0220@gmail.com> | 2016-01-12 04:25:59 +0800 |
commit | ac664e7f86593ff3d70576ac475f07f9c91b9ca8 (patch) | |
tree | 96c9adab5db2c29cfc801146125f76a8f6597fe1 /libsolidity/codegen/ExpressionCompiler.cpp | |
parent | c7df6d03103093356323a3befbcd9d3e9cdfc117 (diff) | |
download | dexon-solidity-ac664e7f86593ff3d70576ac475f07f9c91b9ca8.tar.gz dexon-solidity-ac664e7f86593ff3d70576ac475f07f9c91b9ca8.tar.zst dexon-solidity-ac664e7f86593ff3d70576ac475f07f9c91b9ca8.zip |
final changes to typechecker, the expression compiler, and a couple more tests for good measure
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index c5f0f97e..f0dab41a 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -186,7 +186,7 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) _assignment.leftHandSide().annotation().type ); utils().convertType(*_assignment.rightHandSide().annotation().type, *type); - + _assignment.leftHandSide().accept(*this); solAssert(!!m_currentLValue, "LValue not retrieved."); @@ -222,18 +222,17 @@ bool ExpressionCompiler::visit(TupleExpression const& _tuple) if (_tuple.isInlineArray()) { ArrayType const& arrayType = dynamic_cast<ArrayType const&>(*_tuple.annotation().type); - auto components = _tuple.components(); + solAssert(!arrayType.isDynamicallySized(), "Cannot create dynamically sized inline array."); m_context << max(u256(32u), arrayType.memorySize()); utils().allocateMemory(); m_context << eth::Instruction::DUP1; - for (unsigned i = 0; i < components.size(); ++i) + for (auto const& component: _tuple.components()) { - components[i]->accept(*this); - utils().convertType(*components[i]->annotation().type, *arrayType.baseType(), true); - components[i]->annotation().type = arrayType.baseType(); //force conversion - utils().storeInMemoryDynamic(*components[i]->annotation().type, true); + component->accept(*this); + utils().convertType(*component->annotation().type, *arrayType.baseType(), true); + utils().storeInMemoryDynamic(*arrayType.baseType(), true); } m_context << eth::Instruction::POP; @@ -1155,7 +1154,7 @@ void ExpressionCompiler::endVisit(Literal const& _literal) break; // will be done during conversion default: BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Only integer, boolean and string literals implemented for now.")); - } + } } void ExpressionCompiler::appendAndOrOperatorCode(BinaryOperation const& _binaryOperation) |