diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-02-21 03:09:46 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-02-21 05:51:23 +0800 |
commit | d0c36795a0998f9ad143c01882cb33334cbd471c (patch) | |
tree | 13937265ed0e1e0ce325cfb0e25f3a1284ff7cd6 /ExpressionCompiler.cpp | |
parent | 858acaa1937ccc2f6cc13bb3076abc32c43789b0 (diff) | |
download | dexon-solidity-d0c36795a0998f9ad143c01882cb33334cbd471c.tar dexon-solidity-d0c36795a0998f9ad143c01882cb33334cbd471c.tar.gz dexon-solidity-d0c36795a0998f9ad143c01882cb33334cbd471c.tar.bz2 dexon-solidity-d0c36795a0998f9ad143c01882cb33334cbd471c.tar.lz dexon-solidity-d0c36795a0998f9ad143c01882cb33334cbd471c.tar.xz dexon-solidity-d0c36795a0998f9ad143c01882cb33334cbd471c.tar.zst dexon-solidity-d0c36795a0998f9ad143c01882cb33334cbd471c.zip |
renamed fromIdentifier to fromStateVariable
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r-- | ExpressionCompiler.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index 653bf829..e76a8a79 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -69,7 +69,7 @@ void ExpressionCompiler::appendStateVariableInitialization(CompilerContext& _con void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration const& _varDecl) { LValue lvalue = LValue(m_context); - lvalue.fromVariableDeclaration(_varDecl); + lvalue.fromDeclaration(_varDecl, _varDecl.getValue()->getLocation()); lvalue.storeValue(*_varDecl.getType(), _varDecl.getLocation()); } @@ -588,7 +588,7 @@ void ExpressionCompiler::endVisit(Identifier const& _identifier) m_context << m_context.getVirtualFunctionEntryLabel(*functionDef).pushTag(); else if (dynamic_cast<VariableDeclaration const*>(declaration)) { - m_currentLValue.fromIdentifier(_identifier, *declaration); + m_currentLValue.fromDeclaration(*declaration, _identifier.getLocation()); m_currentLValue.retrieveValueIfLValueNotRequested(_identifier); } else if (dynamic_cast<ContractDefinition const*>(declaration)) @@ -1018,32 +1018,29 @@ ExpressionCompiler::LValue::LValue(CompilerContext& _compilerContext, LValueType m_size = unsigned(m_dataType->getSizeOnStack()); } -void ExpressionCompiler::LValue::fromIdentifier(Identifier const& _identifier, Declaration const& _declaration) +void ExpressionCompiler::LValue::fromDeclaration(Declaration const& _declaration, Location const& _location) { if (m_context->isLocalVariable(&_declaration)) { m_type = LValueType::Stack; - m_dataType = _identifier.getType(); + m_dataType = _declaration.getType(); m_size = m_dataType->getSizeOnStack(); m_baseStackOffset = m_context->getBaseStackOffsetOfVariable(_declaration); } else if (m_context->isStateVariable(&_declaration)) - fromVariableDeclaration(_declaration); + { + *m_context << m_context->getStorageLocationOfVariable(_declaration); + m_type = LValueType::Storage; + m_dataType = _declaration.getType(); + solAssert(m_dataType->getStorageSize() <= numeric_limits<unsigned>::max(), + "The storage size of " + m_dataType->toString() + " should fit in an unsigned"); + m_size = unsigned(m_dataType->getStorageSize()); + } else - BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_sourceLocation(_identifier.getLocation()) + BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_sourceLocation(_location) << errinfo_comment("Identifier type not supported or identifier not found.")); } -void ExpressionCompiler::LValue::fromVariableDeclaration(Declaration const& _declaration) -{ - *m_context << m_context->getStorageLocationOfVariable(_declaration); - m_type = LValueType::Storage; - m_dataType = _declaration.getType(); - solAssert(m_dataType->getStorageSize() <= numeric_limits<unsigned>::max(), - "The storage size of " + m_dataType->toString() + " should fit in an unsigned"); - m_size = unsigned(m_dataType->getStorageSize()); -} - void ExpressionCompiler::LValue::retrieveValue(Location const& _location, bool _remove) const { switch (m_type) |