More checks for missing mobile type.

This commit is contained in:
chriseth
2016-10-24 16:45:25 +02:00
parent 6b028701a0
commit f25aa0c68b
5 changed files with 46 additions and 12 deletions
+14 -2
View File
@@ -198,7 +198,9 @@ TypePointer Type::forLiteral(Literal const& _literal)
TypePointer Type::commonType(TypePointer const& _a, TypePointer const& _b)
{
if (_b->isImplicitlyConvertibleTo(*_a))
if (!_a || !_b)
return TypePointer();
else if (_b->isImplicitlyConvertibleTo(*_a))
return _a;
else if (_a->isImplicitlyConvertibleTo(*_b))
return _b;
@@ -1661,7 +1663,17 @@ TypePointer TupleType::mobileType() const
{
TypePointers mobiles;
for (auto const& c: components())
mobiles.push_back(c ? c->mobileType() : TypePointer());
{
if (c)
{
auto mt = c->mobileType();
if (!mt)
return TypePointer();
mobiles.push_back(mt);
}
else
mobiles.push_back(TypePointer());
}
return make_shared<TupleType>(mobiles);
}