diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-09 22:05:22 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-09 22:05:22 +0800 |
commit | 5ae0a975b373eb19aeb5eb7a17ccf46f3b63f56a (patch) | |
tree | c230463eec25c83a63b2a849b7939b16007e511e /CompilerContext.h | |
parent | 5c713d14299931ba214ff3c673db954567734975 (diff) | |
parent | cd8a0ab65d387cd88f3062f937a456b7c0e33b5c (diff) | |
download | dexon-solidity-5ae0a975b373eb19aeb5eb7a17ccf46f3b63f56a.tar dexon-solidity-5ae0a975b373eb19aeb5eb7a17ccf46f3b63f56a.tar.gz dexon-solidity-5ae0a975b373eb19aeb5eb7a17ccf46f3b63f56a.tar.bz2 dexon-solidity-5ae0a975b373eb19aeb5eb7a17ccf46f3b63f56a.tar.lz dexon-solidity-5ae0a975b373eb19aeb5eb7a17ccf46f3b63f56a.tar.xz dexon-solidity-5ae0a975b373eb19aeb5eb7a17ccf46f3b63f56a.tar.zst dexon-solidity-5ae0a975b373eb19aeb5eb7a17ccf46f3b63f56a.zip |
Merge remote-tracking branch 'upstream/develop' into evmjit
Diffstat (limited to 'CompilerContext.h')
-rw-r--r-- | CompilerContext.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/CompilerContext.h b/CompilerContext.h index e42e7c76..4d63d8ba 100644 --- a/CompilerContext.h +++ b/CompilerContext.h @@ -108,15 +108,15 @@ public: /// Resets the stack of visited nodes with a new stack having only @c _node void resetVisitedNodes(ASTNode const* _node); /// Pops the stack of visited nodes - void popVisitedNodes() { m_visitedNodes.pop(); } + void popVisitedNodes() { m_visitedNodes.pop(); updateSourceLocation(); } /// Pushes an ASTNode to the stack of visited nodes - void pushVisitedNodes(ASTNode const* _node) { m_visitedNodes.push(_node); } + void pushVisitedNodes(ASTNode const* _node) { m_visitedNodes.push(_node); updateSourceLocation(); } /// Append elements to the current instruction list and adjust @a m_stackOffset. - CompilerContext& operator<<(eth::AssemblyItem const& _item); - CompilerContext& operator<<(eth::Instruction _instruction); - CompilerContext& operator<<(u256 const& _value); - CompilerContext& operator<<(bytes const& _data); + CompilerContext& operator<<(eth::AssemblyItem const& _item) { m_asm.append(_item); return *this; } + CompilerContext& operator<<(eth::Instruction _instruction) { m_asm.append(_instruction); return *this; } + CompilerContext& operator<<(u256 const& _value) { m_asm.append(_value); return *this; } + CompilerContext& operator<<(bytes const& _data) { m_asm.append(_data); return *this; } eth::Assembly const& getAssembly() const { return m_asm; } /// @arg _sourceCodes is the map of input files to source code strings @@ -130,12 +130,14 @@ public: class LocationSetter: public ScopeGuard { public: - LocationSetter(CompilerContext& _compilerContext, ASTNode const* _node): - ScopeGuard(std::bind(&CompilerContext::popVisitedNodes, _compilerContext)) { _compilerContext.pushVisitedNodes(_node); } + LocationSetter(CompilerContext& _compilerContext, ASTNode const& _node): + ScopeGuard([&]{ _compilerContext.popVisitedNodes(); }) { _compilerContext.pushVisitedNodes(&_node); } }; private: std::vector<ContractDefinition const*>::const_iterator getSuperContract(const ContractDefinition &_contract) const; + /// Updates source location set in the assembly. + void updateSourceLocation(); eth::Assembly m_asm; /// Magic global variables like msg, tx or this, distinguished by type. |