From a823de2d5863efb45e6d0a9d11e41f511687b831 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 15 Oct 2015 14:37:11 +0200 Subject: push() for byte arrays also properly implemented --- libsolidity/ExpressionCompiler.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libsolidity/ExpressionCompiler.cpp') diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index 2d3126c8..85302afc 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -624,7 +624,6 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) break; } case Location::ByteArrayPush: - solAssert(false, "Not properly implemented yet"); case Location::ArrayPush: { _functionCall.expression().accept(*this); @@ -651,12 +650,15 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) arguments[0]->accept(*this); // stack: newLength storageSlot slotOffset argValue TypePointer type = arguments[0]->annotation().type; - utils().convertType(*type, *type->mobileType()); - type = type->mobileType(); + utils().convertType(*type, *arrayType->baseType()); + type = arrayType->baseType(); utils().moveToStackTop(1 + type->sizeOnStack()); utils().moveToStackTop(1 + type->sizeOnStack()); // stack: newLength argValue storageSlot slotOffset - StorageItem(m_context, *paramType).storeValue(*type, _functionCall.location(), true); + if (function.location() == Location::ArrayPush) + StorageItem(m_context, *paramType).storeValue(*type, _functionCall.location(), true); + else + StorageByteArrayElement(m_context).storeValue(*type, _functionCall.location(), true); break; } default: -- cgit v1.2.3