diff options
author | chriseth <c@ethdev.com> | 2016-12-13 23:50:50 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-12-13 23:50:50 +0800 |
commit | e9d3327ad6883acc6db8306bb7fa5ccbd802af9c (patch) | |
tree | 7daad64d2fa0b4f826e79ac8275338be5f1bf2fe /libsolidity | |
parent | f7e219ed91f256ee076b72c47a1168e32a1ef705 (diff) | |
download | dexon-solidity-e9d3327ad6883acc6db8306bb7fa5ccbd802af9c.tar dexon-solidity-e9d3327ad6883acc6db8306bb7fa5ccbd802af9c.tar.gz dexon-solidity-e9d3327ad6883acc6db8306bb7fa5ccbd802af9c.tar.bz2 dexon-solidity-e9d3327ad6883acc6db8306bb7fa5ccbd802af9c.tar.lz dexon-solidity-e9d3327ad6883acc6db8306bb7fa5ccbd802af9c.tar.xz dexon-solidity-e9d3327ad6883acc6db8306bb7fa5ccbd802af9c.tar.zst dexon-solidity-e9d3327ad6883acc6db8306bb7fa5ccbd802af9c.zip |
Use correct type for storing.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index afe91c5c..a7fb8408 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -225,7 +225,9 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) _assignment.leftHandSide().accept(*this); solAssert(!!m_currentLValue, "LValue not retrieved."); - if (op != Token::Assign) // compound assignment + if (op == Token::Assign) + m_currentLValue->storeValue(*rightIntermediateType, _assignment.location()); + else // compound assignment { solAssert(leftType.isValueType(), "Compound operators only available for value types."); unsigned lvalueSize = m_currentLValue->sizeOnStack(); @@ -239,14 +241,12 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) m_currentLValue->retrieveValue(_assignment.location(), true); utils().convertType(leftType, leftType, cleanupNeeded); - Token::Value targetOp = Token::AssignmentToBinaryOp(op); - - if (Token::isShiftOp(targetOp)) - appendShiftOperatorCode(targetOp, leftType, *rightIntermediateType); + if (Token::isShiftOp(binOp)) + appendShiftOperatorCode(binOp, leftType, *rightIntermediateType); else { solAssert(leftType == *rightIntermediateType, ""); - appendOrdinaryBinaryOperatorCode(targetOp, leftType); + appendOrdinaryBinaryOperatorCode(binOp, leftType); } if (lvalueSize > 0) { @@ -255,8 +255,8 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) for (unsigned i = 0; i < itemSize; ++i) m_context << swapInstruction(itemSize + lvalueSize) << Instruction::POP; } + m_currentLValue->storeValue(*_assignment.annotation().type, _assignment.location()); } - m_currentLValue->storeValue(*rightIntermediateType, _assignment.location()); m_currentLValue.reset(); return false; } |