aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-10-21 18:30:58 +0800
committerchriseth <c@ethdev.com>2016-10-24 22:45:25 +0800
commitf25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc (patch)
tree171fbfef357688e567e5b3a48ea0b4363a1916ba /libsolidity/codegen/ExpressionCompiler.cpp
parent6b028701a0dfd239ddfcf9e4d40bfe36414a956f (diff)
downloaddexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.gz
dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.zst
dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.zip
More checks for missing mobile type.
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index da3e56cc..6d54b48b 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -56,8 +56,10 @@ void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration c
if (_varDecl.annotation().type->dataStoredIn(DataLocation::Storage))
{
// reference type, only convert value to mobile type and do final conversion in storeValue.
- utils().convertType(*type, *type->mobileType());
- type = type->mobileType();
+ auto mt = type->mobileType();
+ solAssert(mt, "");
+ utils().convertType(*type, *mt);
+ type = mt;
}
else
{
@@ -1437,11 +1439,17 @@ void ExpressionCompiler::appendExternalFunctionCall(
// Evaluate arguments.
TypePointers argumentTypes;
TypePointers parameterTypes = _functionType.parameterTypes();
- bool manualFunctionId =
+ bool manualFunctionId = false;
+ if (
(funKind == FunctionKind::Bare || funKind == FunctionKind::BareCallCode || funKind == FunctionKind::BareDelegateCall) &&
- !_arguments.empty() &&
- _arguments.front()->annotation().type->mobileType()->calldataEncodedSize(false) ==
+ !_arguments.empty()
+ )
+ {
+ solAssert(_arguments.front()->annotation().type->mobileType(), "");
+ manualFunctionId =
+ _arguments.front()->annotation().type->mobileType()->calldataEncodedSize(false) ==
CompilerUtils::dataStartOffset;
+ }
if (manualFunctionId)
{
// If we have a Bare* and the first type has exactly 4 bytes, use it as