diff options
author | Christian <c@ethdev.com> | 2015-02-25 22:55:42 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-02-25 22:55:42 +0800 |
commit | 29c614ebaf551006bc6c028592917e8f0dd5cf96 (patch) | |
tree | ea47dd14cb9ba8a303434071dac8514b36c98d8d /ExpressionCompiler.cpp | |
parent | cc31a7ab321a974cd81de2b539ec2bf7db2b2358 (diff) | |
download | dexon-solidity-29c614ebaf551006bc6c028592917e8f0dd5cf96.tar.gz dexon-solidity-29c614ebaf551006bc6c028592917e8f0dd5cf96.tar.zst dexon-solidity-29c614ebaf551006bc6c028592917e8f0dd5cf96.zip |
Removed code duplication.
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r-- | ExpressionCompiler.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index 6b9b5167..67686df1 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -1031,30 +1031,19 @@ void ExpressionCompiler::appendExpressionCopyToMemory(Type const& _expectedType, void ExpressionCompiler::setLValueFromDeclaration(Declaration const& _declaration, Expression const& _expression) { - solAssert(!m_currentLValue, "Current LValue not reset when trying to set to new one."); - std::unique_ptr<LValue> lvalue; if (m_context.isLocalVariable(&_declaration)) - lvalue.reset(new StackVariable(m_context, _declaration)); + setLValue<StackVariable>(_expression, _declaration); else if (m_context.isStateVariable(&_declaration)) - lvalue.reset(new StorageItem(m_context, _declaration)); + setLValue<StorageItem>(_expression, _declaration); else BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_sourceLocation(_expression.getLocation()) << errinfo_comment("Identifier type not supported or identifier not found.")); - if (_expression.lvalueRequested()) - m_currentLValue = move(lvalue); - else - lvalue->retrieveValue(_expression.getLocation(), true); } void ExpressionCompiler::setLValueToStorageItem(Expression const& _expression) { - solAssert(!m_currentLValue, "Current LValue not reset when trying to set to new one."); - std::unique_ptr<LValue> lvalue(new StorageItem(m_context, _expression.getType())); - if (_expression.lvalueRequested()) - m_currentLValue = move(lvalue); - else - lvalue->retrieveValue(_expression.getLocation(), true); + setLValue<StorageItem>(_expression, _expression.getType()); } } |