aboutsummaryrefslogtreecommitdiffstats
path: root/Compiler.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-11-05 02:13:03 +0800
committerChristian <c@ethdev.com>2014-11-06 09:36:39 +0800
commit13baaf98b8a3ca2a97c96e5a25398a0cae26e5fb (patch)
tree79a400acba06f1d3c43885bda0c2f69c2e809ed5 /Compiler.cpp
parent4b6c42231595cd8a53327656db4ac22db70960d5 (diff)
downloaddexon-solidity-13baaf98b8a3ca2a97c96e5a25398a0cae26e5fb.tar.gz
dexon-solidity-13baaf98b8a3ca2a97c96e5a25398a0cae26e5fb.tar.zst
dexon-solidity-13baaf98b8a3ca2a97c96e5a25398a0cae26e5fb.zip
Proper type promotion and conversion.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r--Compiler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Compiler.cpp b/Compiler.cpp
index 654ecead..dfc351fa 100644
--- a/Compiler.cpp
+++ b/Compiler.cpp
@@ -273,7 +273,7 @@ bool Compiler::visit(Return& _return)
{
ExpressionCompiler::compileExpression(m_context, *expression);
VariableDeclaration const& firstVariable = *_return.getFunctionReturnParameters().getParameters().front();
- ExpressionCompiler::cleanHigherOrderBitsIfNeeded(*expression->getType(), *firstVariable.getType());
+ ExpressionCompiler::appendTypeConversion(m_context, *expression->getType(), *firstVariable.getType());
int stackPosition = m_context.getStackPositionOfVariable(firstVariable);
m_context << eth::swapInstruction(stackPosition) << eth::Instruction::POP;
}
@@ -286,8 +286,9 @@ bool Compiler::visit(VariableDefinition& _variableDefinition)
if (Expression* expression = _variableDefinition.getExpression())
{
ExpressionCompiler::compileExpression(m_context, *expression);
- ExpressionCompiler::cleanHigherOrderBitsIfNeeded(*expression->getType(),
- *_variableDefinition.getDeclaration().getType());
+ ExpressionCompiler::appendTypeConversion(m_context,
+ *expression->getType(),
+ *_variableDefinition.getDeclaration().getType());
int stackPosition = m_context.getStackPositionOfVariable(_variableDefinition.getDeclaration());
m_context << eth::swapInstruction(stackPosition) << eth::Instruction::POP;
}