Styling changes for SourceLocation and friends

This commit is contained in:
Lefteris Karapetsas 2015-02-25 09:53:28 +01:00
parent fb328b778c
commit 54121a0d78
4 changed files with 7 additions and 6 deletions

View File

@ -41,6 +41,7 @@ public:
bytes getAssembledBytecode() { return m_context.getAssembledBytecode(m_optimize); } bytes getAssembledBytecode() { return m_context.getAssembledBytecode(m_optimize); }
bytes getRuntimeBytecode() { return m_runtimeContext.getAssembledBytecode(m_optimize);} bytes getRuntimeBytecode() { return m_runtimeContext.getAssembledBytecode(m_optimize);}
void streamAssembly(std::ostream& _stream) const { m_context.streamAssembly(_stream); } void streamAssembly(std::ostream& _stream) const { m_context.streamAssembly(_stream); }
/// Getters for compiler contexts. Only for testing purposes.
CompilerContext const& getContext() const { return m_context; } CompilerContext const& getContext() const { return m_context; }
CompilerContext const& getRuntimeContext() const { return m_runtimeContext; } CompilerContext const& getRuntimeContext() const { return m_runtimeContext; }

View File

@ -175,28 +175,28 @@ void CompilerContext::resetVisitedNodes(ASTNode const* _node)
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.empty(), "No node on the visited stack");
m_asm.append(_item, m_visitedNodes.top()->getLocation()); m_asm.append(_item, m_visitedNodes.top()->getLocation());
return *this; return *this;
} }
CompilerContext& CompilerContext::operator<<(eth::Instruction _instruction) CompilerContext& CompilerContext::operator<<(eth::Instruction _instruction)
{ {
solAssert(m_visitedNodes.size() > 0, "No node on the visited stack"); solAssert(!m_visitedNodes.empty(), "No node on the visited stack");
m_asm.append(_instruction, m_visitedNodes.top()->getLocation()); m_asm.append(_instruction, m_visitedNodes.top()->getLocation());
return *this; return *this;
} }
CompilerContext& CompilerContext::operator<<(u256 const& _value) CompilerContext& CompilerContext::operator<<(u256 const& _value)
{ {
solAssert(m_visitedNodes.size() > 0, "No node on the visited stack"); solAssert(!m_visitedNodes.empty(), "No node on the visited stack");
m_asm.append(_value, m_visitedNodes.top()->getLocation()); m_asm.append(_value, m_visitedNodes.top()->getLocation());
return *this; return *this;
} }
CompilerContext& CompilerContext::operator<<(bytes const& _data) CompilerContext& CompilerContext::operator<<(bytes const& _data)
{ {
solAssert(m_visitedNodes.size() > 0, "No node on the visited stack"); solAssert(!m_visitedNodes.empty(), "No node on the visited stack");
m_asm.append(_data, m_visitedNodes.top()->getLocation()); m_asm.append(_data, m_visitedNodes.top()->getLocation());
return *this; return *this;
} }

View File

@ -103,7 +103,7 @@ public:
/// Resets the stack of visited nodes with a new stack having only @c _node /// Resets the stack of visited nodes with a new stack having only @c _node
void resetVisitedNodes(ASTNode const* _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
void pushVisitedNodes(ASTNode const* _node) { m_visitedNodes.push(_node); } void pushVisitedNodes(ASTNode const* _node) { m_visitedNodes.push(_node); }

View File

@ -165,7 +165,7 @@ bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation)
bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation) bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation)
{ {
CompilerContext::LocationSetter locationSetter(m_context, &_binaryOperation); CompilerContext::LocationSetter locationSetter(m_context, &_binaryOperation);
Expression const& leftExpression = _binaryOperation.getLeftExpression(); Expression const& leftExpression = _binaryOperation.getLeftExpression();
Expression const& rightExpression = _binaryOperation.getRightExpression(); Expression const& rightExpression = _binaryOperation.getRightExpression();
Type const& commonType = _binaryOperation.getCommonType(); Type const& commonType = _binaryOperation.getCommonType();