mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Reset CompilerContext's visited nodes at compile start
This commit is contained in:
parent
1891020ffb
commit
3e5c9a74b2
@ -74,6 +74,7 @@ void Compiler::initializeContext(ContractDefinition const& _contract,
|
|||||||
m_context.setCompiledContracts(_contracts);
|
m_context.setCompiledContracts(_contracts);
|
||||||
m_context.setInheritanceHierarchy(_contract.getLinearizedBaseContracts());
|
m_context.setInheritanceHierarchy(_contract.getLinearizedBaseContracts());
|
||||||
registerStateVariables(_contract);
|
registerStateVariables(_contract);
|
||||||
|
m_context.resetVisitedNodes(&_contract);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Compiler::packIntoContractCreator(ContractDefinition const& _contract, CompilerContext const& _runtimeContext)
|
void Compiler::packIntoContractCreator(ContractDefinition const& _contract, CompilerContext const& _runtimeContext)
|
||||||
|
@ -166,6 +166,13 @@ u256 CompilerContext::getStorageLocationOfVariable(const Declaration& _declarati
|
|||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CompilerContext::resetVisitedNodes(ASTNode const* _node)
|
||||||
|
{
|
||||||
|
stack<ASTNode const*> newStack;
|
||||||
|
newStack.push(_node);
|
||||||
|
std::swap(m_visitedNodes, newStack);
|
||||||
|
}
|
||||||
|
|
||||||
CompilerContext& CompilerContext::operator<<(eth::AssemblyItem _item)
|
CompilerContext& CompilerContext::operator<<(eth::AssemblyItem _item)
|
||||||
{
|
{
|
||||||
solAssert(m_visitedNodes.size() > 0, "No node on the visited stack");
|
solAssert(m_visitedNodes.size() > 0, "No node on the visited stack");
|
||||||
|
@ -100,6 +100,8 @@ public:
|
|||||||
void appendProgramSize() { return m_asm.appendProgramSize(); }
|
void appendProgramSize() { return m_asm.appendProgramSize(); }
|
||||||
/// Adds data to the data section, pushes a reference to the stack
|
/// Adds data to the data section, pushes a reference to the stack
|
||||||
eth::AssemblyItem appendData(bytes const& _data) { return m_asm.append(_data); }
|
eth::AssemblyItem appendData(bytes const& _data) { return m_asm.append(_data); }
|
||||||
|
/// 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
|
/// Pops the stack of visited nodes
|
||||||
void popVisitedNodes() { m_visitedNodes.pop();}
|
void popVisitedNodes() { m_visitedNodes.pop();}
|
||||||
/// Pushes an ASTNode to the stack of visited nodes
|
/// Pushes an ASTNode to the stack of visited nodes
|
||||||
|
Loading…
Reference in New Issue
Block a user