aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/CompilerUtils.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-03-16 01:07:52 +0800
committerGitHub <noreply@github.com>2017-03-16 01:07:52 +0800
commitf0d539ae05739e35336cc9cc8f44bd9798a95c28 (patch)
tree13ef1dea012c7f093122d5e7578dc3c893636e59 /libsolidity/codegen/CompilerUtils.cpp
parent364da425d3116a4b85863df39a1864340861d71e (diff)
parent59099908c53129b2f5723bd0d5283c4da089e398 (diff)
downloaddexon-solidity-f0d539ae05739e35336cc9cc8f44bd9798a95c28.tar
dexon-solidity-f0d539ae05739e35336cc9cc8f44bd9798a95c28.tar.gz
dexon-solidity-f0d539ae05739e35336cc9cc8f44bd9798a95c28.tar.bz2
dexon-solidity-f0d539ae05739e35336cc9cc8f44bd9798a95c28.tar.lz
dexon-solidity-f0d539ae05739e35336cc9cc8f44bd9798a95c28.tar.xz
dexon-solidity-f0d539ae05739e35336cc9cc8f44bd9798a95c28.tar.zst
dexon-solidity-f0d539ae05739e35336cc9cc8f44bd9798a95c28.zip
Merge pull request #1782 from ethereum/develop
Solidity 0.4.10
Diffstat (limited to 'libsolidity/codegen/CompilerUtils.cpp')
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index 477f021a..42323abd 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -200,6 +200,7 @@ void CompilerUtils::encodeToMemory(
// leave end_of_mem as dyn head pointer
m_context << Instruction::DUP1 << u256(32) << Instruction::ADD;
dynPointers++;
+ solAssert((argSize + dynPointers) < 16, "Stack too deep, try using less variables.");
}
else
{
@@ -787,6 +788,20 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp
if (_cleanupNeeded)
m_context << Instruction::ISZERO << Instruction::ISZERO;
break;
+ case Type::Category::Function:
+ {
+ if (targetTypeCategory == Type::Category::Integer)
+ {
+ IntegerType const& targetType = dynamic_cast<IntegerType const&>(_targetType);
+ solAssert(targetType.isAddress(), "Function type can only be converted to address.");
+ FunctionType const& typeOnStack = dynamic_cast<FunctionType const&>(_typeOnStack);
+ solAssert(typeOnStack.location() == FunctionType::Location::External, "Only external function type can be converted.");
+
+ // stack: <address> <function_id>
+ m_context << Instruction::POP;
+ break;
+ }
+ }
default:
// All other types should not be convertible to non-equal types.
solAssert(_typeOnStack == _targetType, "Invalid type conversion requested.");