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/analysis | |
parent | 6b028701a0dfd239ddfcf9e4d40bfe36414a956f (diff) | |
download | dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.gz dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.tar.zst dexon-solidity-f25aa0c68bd8d4c2acf9425c9aba15fc56b16ccc.zip |
More checks for missing mobile type.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index b5955c8f..10d24e5a 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -880,6 +880,10 @@ bool TypeChecker::visit(Conditional const& _conditional) TypePointer trueType = type(_conditional.trueExpression())->mobileType(); TypePointer falseType = type(_conditional.falseExpression())->mobileType(); + if (!trueType) + fatalTypeError(_conditional.trueExpression().location(), "Invalid mobile type."); + if (!falseType) + fatalTypeError(_conditional.falseExpression().location(), "Invalid mobile type."); TypePointer commonType = Type::commonType(trueType, falseType); if (!commonType) @@ -986,10 +990,16 @@ bool TypeChecker::visit(TupleExpression const& _tuple) types.push_back(type(*components[i])); if (_tuple.isInlineArray()) solAssert(!!types[i], "Inline array cannot have empty components"); - if (i == 0 && _tuple.isInlineArray()) - inlineArrayType = types[i]->mobileType(); - else if (_tuple.isInlineArray() && inlineArrayType) - inlineArrayType = Type::commonType(inlineArrayType, types[i]->mobileType()); + if (_tuple.isInlineArray()) + { + if ((i == 0 || inlineArrayType) && !types[i]->mobileType()) + fatalTypeError(components[i]->location(), "Invalid mobile type."); + + if (i == 0) + inlineArrayType = types[i]->mobileType(); + else if (inlineArrayType) + inlineArrayType = Type::commonType(inlineArrayType, types[i]->mobileType()); + } } else types.push_back(TypePointer()); |