From 54121a0d787df1b730fa523b21040c312dda4bf6 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Wed, 25 Feb 2015 09:53:28 +0100 Subject: Styling changes for SourceLocation and friends --- Compiler.h | 1 + CompilerContext.cpp | 8 ++++---- CompilerContext.h | 2 +- ExpressionCompiler.cpp | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Compiler.h b/Compiler.h index a35a18e1..67f3a18e 100644 --- a/Compiler.h +++ b/Compiler.h @@ -41,6 +41,7 @@ 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); } + /// Getters for compiler contexts. Only for testing purposes. CompilerContext const& getContext() const { return m_context; } CompilerContext const& getRuntimeContext() const { return m_runtimeContext; } diff --git a/CompilerContext.cpp b/CompilerContext.cpp index 5fd91e43..8bb6cb00 100644 --- a/CompilerContext.cpp +++ b/CompilerContext.cpp @@ -175,28 +175,28 @@ void CompilerContext::resetVisitedNodes(ASTNode const* _node) 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()); return *this; } 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()); return *this; } 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()); return *this; } 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()); return *this; } diff --git a/CompilerContext.h b/CompilerContext.h index 6ee52a5b..6e1dbfbc 100644 --- a/CompilerContext.h +++ b/CompilerContext.h @@ -103,7 +103,7 @@ 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(); } /// Pushes an ASTNode to the stack of visited nodes void pushVisitedNodes(ASTNode const* _node) { m_visitedNodes.push(_node); } diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index 5a78aaad..90a3f3ac 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -165,7 +165,7 @@ bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation) 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& rightExpression = _binaryOperation.getRightExpression(); Type const& commonType = _binaryOperation.getCommonType(); -- cgit v1.2.3