diff options
author | chriseth <c@ethdev.com> | 2016-10-21 18:30:58 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-10-24 22:45:25 +0800 |
commit | f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc (patch) | |
tree | 171fbfef357688e567e5b3a48ea0b4363a1916ba /libsolidity/ast/Types.cpp | |
parent | 6b028701a0dfd239ddfcf9e4d40bfe36414a956f (diff) | |
download | dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.gz dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.bz2 dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.lz dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.xz dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.zst dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.zip |
More checks for missing mobile type.
Diffstat (limited to 'libsolidity/ast/Types.cpp')
-rw-r--r-- | libsolidity/ast/Types.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 88bdee9f..7cfed3c8 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -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); } |