diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-03 23:38:06 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-03 23:38:06 +0800 |
commit | f9b90feea028154d8fdb537034c80fbf50260043 (patch) | |
tree | e2de5efd081f1700a15e1fe0ec5a6964a9f9ecf1 /libsolidity/analysis | |
parent | 1e4b5886d61328d951fc03dc88cfc3dd722a3a00 (diff) | |
download | dexon-solidity-f9b90feea028154d8fdb537034c80fbf50260043.tar.gz dexon-solidity-f9b90feea028154d8fdb537034c80fbf50260043.tar.zst dexon-solidity-f9b90feea028154d8fdb537034c80fbf50260043.zip |
Review suggestions; to be squashed.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 1d30881c..6f0ab28b 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1322,14 +1322,16 @@ void TypeChecker::checkExpressionAssignment(Type const& _type, Expression const& { if (auto const* tupleExpression = dynamic_cast<TupleExpression const*>(&_expression)) { - if (auto const* tupleType = dynamic_cast<TupleType const*>(&_type)) - { - for (size_t i = 0; i < min(tupleExpression->components().size(), tupleType->components().size()); i++) - if (tupleType->components()[i] && tupleExpression->components()[i]) - checkExpressionAssignment(*tupleType->components()[i], *tupleExpression->components()[i]); - } - else if (!tupleExpression->components().empty()) - checkExpressionAssignment(_type, *tupleExpression->components().front()); + auto const* tupleType = dynamic_cast<TupleType const*>(&_type); + auto const& types = tupleType ? tupleType->components() : vector<TypePointer> { _type.shared_from_this() }; + + solAssert(tupleExpression->components().size() == types.size(), ""); + for (size_t i = 0; i < types.size(); i++) + if (types[i]) + { + solAssert(!!tupleExpression->components()[i], ""); + checkExpressionAssignment(*types[i], *tupleExpression->components()[i]); + } } else if (_type.category() == Type::Category::Mapping) { |