diff options
author | chriseth <c@ethdev.com> | 2015-03-08 06:08:39 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-03-09 20:28:29 +0800 |
commit | 94c51caf89a86e29dab21141d76eae0c73292b01 (patch) | |
tree | 2d11b97c706515895836a6b2130f24d723136517 /CompilerContext.cpp | |
parent | 67ffc3db714bf1a4930a9e340e500285e985222f (diff) | |
download | dexon-solidity-94c51caf89a86e29dab21141d76eae0c73292b01.tar.gz dexon-solidity-94c51caf89a86e29dab21141d76eae0c73292b01.tar.zst dexon-solidity-94c51caf89a86e29dab21141d76eae0c73292b01.zip |
Fixed: Some instructions did not have source locations.
Diffstat (limited to 'CompilerContext.cpp')
-rw-r--r-- | CompilerContext.cpp | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/CompilerContext.cpp b/CompilerContext.cpp index ee8d3e00..1dea62e9 100644 --- a/CompilerContext.cpp +++ b/CompilerContext.cpp @@ -69,7 +69,7 @@ void CompilerContext::removeVariable(VariableDeclaration const& _declaration) void CompilerContext::addAndInitializeVariable(VariableDeclaration const& _declaration) { - LocationSetter locationSetter(*this, &_declaration); + LocationSetter locationSetter(*this, _declaration); addVariable(_declaration); int const size = _declaration.getType()->getSizeOnStack(); for (int i = 0; i < size; ++i) @@ -182,34 +182,7 @@ void CompilerContext::resetVisitedNodes(ASTNode const* _node) stack<ASTNode const*> newStack; newStack.push(_node); std::swap(m_visitedNodes, newStack); -} - -CompilerContext& CompilerContext::operator<<(eth::AssemblyItem const& _item) -{ - solAssert(!m_visitedNodes.empty(), "No node on the visited stack"); - m_asm.append(_item, m_visitedNodes.top()->getLocation()); - return *this; -} - -CompilerContext& CompilerContext::operator<<(eth::Instruction _instruction) -{ - solAssert(!m_visitedNodes.empty(), "No node on the visited stack"); - m_asm.append(_instruction, m_visitedNodes.top()->getLocation()); - return *this; -} - -CompilerContext& CompilerContext::operator<<(u256 const& _value) -{ - solAssert(!m_visitedNodes.empty(), "No node on the visited stack"); - m_asm.append(_value, m_visitedNodes.top()->getLocation()); - return *this; -} - -CompilerContext& CompilerContext::operator<<(bytes const& _data) -{ - solAssert(!m_visitedNodes.empty(), "No node on the visited stack"); - m_asm.append(_data, m_visitedNodes.top()->getLocation()); - return *this; + updateSourceLocation(); } vector<ContractDefinition const*>::const_iterator CompilerContext::getSuperContract(ContractDefinition const& _contract) const @@ -220,5 +193,10 @@ vector<ContractDefinition const*>::const_iterator CompilerContext::getSuperContr return ++it; } +void CompilerContext::updateSourceLocation() +{ + m_asm.setSourceLocation(m_visitedNodes.empty() ? SourceLocation() : m_visitedNodes.top()->getLocation()); +} + } } |