diff options
author | Christian <c@ethdev.com> | 2014-12-12 00:35:23 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-12-12 00:48:44 +0800 |
commit | 66d95abfd9d0a1c3d6516dec39d085d7d96cccbf (patch) | |
tree | 53e5437546d139627742a77df25c41bafb9e0005 /Compiler.cpp | |
parent | 6fcdfdc353cb4100f8a1a3c139e0fa9dc9302397 (diff) | |
download | dexon-solidity-66d95abfd9d0a1c3d6516dec39d085d7d96cccbf.tar dexon-solidity-66d95abfd9d0a1c3d6516dec39d085d7d96cccbf.tar.gz dexon-solidity-66d95abfd9d0a1c3d6516dec39d085d7d96cccbf.tar.bz2 dexon-solidity-66d95abfd9d0a1c3d6516dec39d085d7d96cccbf.tar.lz dexon-solidity-66d95abfd9d0a1c3d6516dec39d085d7d96cccbf.tar.xz dexon-solidity-66d95abfd9d0a1c3d6516dec39d085d7d96cccbf.tar.zst dexon-solidity-66d95abfd9d0a1c3d6516dec39d085d7d96cccbf.zip |
Swap literals to the end if optimizing.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r-- | Compiler.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index b094af19..d41bcffa 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -246,7 +246,7 @@ bool Compiler::visit(FunctionDefinition const& _function) bool Compiler::visit(IfStatement const& _ifStatement) { - ExpressionCompiler::compileExpression(m_context, _ifStatement.getCondition()); + compileExpression(_ifStatement.getCondition()); eth::AssemblyItem trueTag = m_context.appendConditionalJump(); if (_ifStatement.getFalseStatement()) _ifStatement.getFalseStatement()->accept(*this); @@ -265,7 +265,7 @@ bool Compiler::visit(WhileStatement const& _whileStatement) m_breakTags.push_back(loopEnd); m_context << loopStart; - ExpressionCompiler::compileExpression(m_context, _whileStatement.getCondition()); + compileExpression(_whileStatement.getCondition()); m_context << eth::Instruction::ISZERO; m_context.appendConditionalJumpTo(loopEnd); @@ -298,7 +298,7 @@ bool Compiler::visit(Return const& _return) //@todo modifications are needed to make this work with functions returning multiple values if (Expression const* expression = _return.getExpression()) { - ExpressionCompiler::compileExpression(m_context, *expression); + compileExpression(*expression); VariableDeclaration const& firstVariable = *_return.getFunctionReturnParameters().getParameters().front(); ExpressionCompiler::appendTypeConversion(m_context, *expression->getType(), *firstVariable.getType()); @@ -312,7 +312,7 @@ bool Compiler::visit(VariableDefinition const& _variableDefinition) { if (Expression const* expression = _variableDefinition.getExpression()) { - ExpressionCompiler::compileExpression(m_context, *expression); + compileExpression(*expression); ExpressionCompiler::appendTypeConversion(m_context, *expression->getType(), *_variableDefinition.getDeclaration().getType()); @@ -324,10 +324,15 @@ bool Compiler::visit(VariableDefinition const& _variableDefinition) bool Compiler::visit(ExpressionStatement const& _expressionStatement) { Expression const& expression = _expressionStatement.getExpression(); - ExpressionCompiler::compileExpression(m_context, expression); + compileExpression(expression); CompilerUtils(m_context).popStackElement(*expression.getType()); return false; } +void Compiler::compileExpression(Expression const& _expression) +{ + ExpressionCompiler::compileExpression(m_context, _expression, m_optimize); +} + } } |