aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-26 22:52:30 +0800
committerchriseth <c@ethdev.com>2015-06-26 22:55:42 +0800
commit342ca948661a3f2088b3025b5f15c97d3a53f86e (patch)
tree57a5c39bc60253dc82facfd7af664d9a8fe4d5fd /Types.cpp
parent2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8 (diff)
downloaddexon-solidity-342ca948661a3f2088b3025b5f15c97d3a53f86e.tar.gz
dexon-solidity-342ca948661a3f2088b3025b5f15c97d3a53f86e.tar.zst
dexon-solidity-342ca948661a3f2088b3025b5f15c97d3a53f86e.zip
Fixed and simplified external type computation.
Diffstat (limited to 'Types.cpp')
-rw-r--r--Types.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/Types.cpp b/Types.cpp
index 01876b5a..15c36742 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -827,15 +827,16 @@ TypePointer ArrayType::externalType() const
{
if (m_arrayKind != ArrayKind::Ordinary)
return this->copyForLocation(DataLocation::Memory, true);
- if (!m_baseType->externalType())
+ TypePointer baseExt = m_baseType->externalType();
+ if (!baseExt)
return TypePointer();
if (m_baseType->getCategory() == Category::Array && m_baseType->isDynamicallySized())
return TypePointer();
if (isDynamicallySized())
- return std::make_shared<ArrayType>(DataLocation::Memory, m_baseType->externalType());
+ return std::make_shared<ArrayType>(DataLocation::Memory, baseExt);
else
- return std::make_shared<ArrayType>(DataLocation::Memory, m_baseType->externalType(), m_length);
+ return std::make_shared<ArrayType>(DataLocation::Memory, baseExt, m_length);
}
TypePointer ArrayType::copyForLocation(DataLocation _location, bool _isPointer) const
@@ -1268,15 +1269,17 @@ FunctionTypePointer FunctionType::externalFunctionType() const
for (auto type: m_parameterTypes)
{
- if (!type->externalType())
+ if (auto ext = type->externalType())
+ paramTypes.push_back(ext);
+ else
return FunctionTypePointer();
- paramTypes.push_back(type->externalType());
}
for (auto type: m_returnParameterTypes)
{
- if (!type->externalType())
+ if (auto ext = type->externalType())
+ retParamTypes.push_back(ext);
+ else
return FunctionTypePointer();
- retParamTypes.push_back(type->externalType());
}
return make_shared<FunctionType>(paramTypes, retParamTypes, m_parameterNames, m_returnParameterNames, m_location, m_arbitraryParameters);
}