From 12c32392abc4af2f7da0793e178705c55c742e79 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Tue, 24 Feb 2015 17:08:27 +0100 Subject: [PATCH] Simple Assembly Locations test - Also adding some helper functions to SourceLocation --- Compiler.h | 2 ++ CompilerContext.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Compiler.h b/Compiler.h index 28ab34adb..a35a18e1d 100644 --- a/Compiler.h +++ b/Compiler.h @@ -41,6 +41,8 @@ public: bytes getAssembledBytecode() { return m_context.getAssembledBytecode(m_optimize); } bytes getRuntimeBytecode() { return m_runtimeContext.getAssembledBytecode(m_optimize);} void streamAssembly(std::ostream& _stream) const { m_context.streamAssembly(_stream); } + CompilerContext const& getContext() const { return m_context; } + CompilerContext const& getRuntimeContext() const { return m_runtimeContext; } private: /// Registers the non-function objects inside the contract with the context. diff --git a/CompilerContext.cpp b/CompilerContext.cpp index 67a367240..5fd91e435 100644 --- a/CompilerContext.cpp +++ b/CompilerContext.cpp @@ -176,28 +176,28 @@ void CompilerContext::resetVisitedNodes(ASTNode const* _node) CompilerContext& CompilerContext::operator<<(eth::AssemblyItem _item) { solAssert(m_visitedNodes.size() > 0, "No node on the visited stack"); - m_asm.append(_item); + m_asm.append(_item, m_visitedNodes.top()->getLocation()); return *this; } CompilerContext& CompilerContext::operator<<(eth::Instruction _instruction) { solAssert(m_visitedNodes.size() > 0, "No node on the visited stack"); - m_asm.append(_instruction); + m_asm.append(_instruction, m_visitedNodes.top()->getLocation()); return *this; } CompilerContext& CompilerContext::operator<<(u256 const& _value) { solAssert(m_visitedNodes.size() > 0, "No node on the visited stack"); - m_asm.append(_value); + m_asm.append(_value, m_visitedNodes.top()->getLocation()); return *this; } CompilerContext& CompilerContext::operator<<(bytes const& _data) { solAssert(m_visitedNodes.size() > 0, "No node on the visited stack"); - m_asm.append(_data); + m_asm.append(_data, m_visitedNodes.top()->getLocation()); return *this; }