diff options
author | chriseth <c@ethdev.com> | 2015-10-14 21:19:50 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-10-15 23:38:42 +0800 |
commit | 039b2a764f3944768bb253102f4c4b788f2dca9c (patch) | |
tree | c3cc0cac454b2f0a567b1e9d6c10e1ac16be0858 /libsolidity/TypeChecker.cpp | |
parent | 7ebd536e79215f06f5ce7e14591aa494d06032b6 (diff) | |
download | dexon-solidity-039b2a764f3944768bb253102f4c4b788f2dca9c.tar.gz dexon-solidity-039b2a764f3944768bb253102f4c4b788f2dca9c.tar.zst dexon-solidity-039b2a764f3944768bb253102f4c4b788f2dca9c.zip |
Destructuring assignments.
Diffstat (limited to 'libsolidity/TypeChecker.cpp')
-rw-r--r-- | libsolidity/TypeChecker.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libsolidity/TypeChecker.cpp b/libsolidity/TypeChecker.cpp index c7b693bb..e9d01a84 100644 --- a/libsolidity/TypeChecker.cpp +++ b/libsolidity/TypeChecker.cpp @@ -730,7 +730,13 @@ bool TypeChecker::visit(Assignment const& _assignment) requireLValue(_assignment.leftHandSide()); TypePointer t = type(_assignment.leftHandSide()); _assignment.annotation().type = t; - if (t->category() == Type::Category::Mapping) + if (TupleType const* tupleType = dynamic_cast<TupleType const*>(t.get())) + { + // Sequenced assignments of tuples is not valid. + _assignment.annotation().type = make_shared<TupleType const>(); + expectType(_assignment.rightHandSide(), *tupleType); + } + else if (t->category() == Type::Category::Mapping) { typeError(_assignment, "Mappings cannot be assigned to."); _assignment.rightHandSide().accept(*this); |