mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Removed a redundant else clause.
This commit is contained in:
parent
7a9e024e90
commit
3ef510bc86
@ -1430,41 +1430,37 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
|
|||||||
{
|
{
|
||||||
if (!components[i])
|
if (!components[i])
|
||||||
m_errorReporter.fatalTypeError(_tuple.location(), "Tuple component cannot be empty.");
|
m_errorReporter.fatalTypeError(_tuple.location(), "Tuple component cannot be empty.");
|
||||||
else if (components[i])
|
|
||||||
{
|
|
||||||
components[i]->accept(*this);
|
|
||||||
types.push_back(type(*components[i]));
|
|
||||||
|
|
||||||
if (types[i]->category() == Type::Category::Tuple)
|
components[i]->accept(*this);
|
||||||
if (dynamic_cast<TupleType const&>(*types[i]).components().empty())
|
types.push_back(type(*components[i]));
|
||||||
{
|
|
||||||
if (_tuple.isInlineArray())
|
|
||||||
m_errorReporter.fatalTypeError(components[i]->location(), "Array component cannot be empty.");
|
|
||||||
m_errorReporter.typeError(components[i]->location(), "Tuple component cannot be empty.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: code generation will visit each of the expression even if they are not assigned from.
|
if (types[i]->category() == Type::Category::Tuple)
|
||||||
if (types[i]->category() == Type::Category::RationalNumber && components.size() > 1)
|
if (dynamic_cast<TupleType const&>(*types[i]).components().empty())
|
||||||
if (!dynamic_cast<RationalNumberType const&>(*types[i]).mobileType())
|
|
||||||
m_errorReporter.fatalTypeError(components[i]->location(), "Invalid rational number.");
|
|
||||||
|
|
||||||
if (_tuple.isInlineArray())
|
|
||||||
{
|
{
|
||||||
solAssert(!!types[i], "Inline array cannot have empty components");
|
if (_tuple.isInlineArray())
|
||||||
|
m_errorReporter.fatalTypeError(components[i]->location(), "Array component cannot be empty.");
|
||||||
if ((i == 0 || inlineArrayType) && !types[i]->mobileType())
|
m_errorReporter.typeError(components[i]->location(), "Tuple component cannot be empty.");
|
||||||
m_errorReporter.fatalTypeError(components[i]->location(), "Invalid mobile type.");
|
|
||||||
|
|
||||||
if (i == 0)
|
|
||||||
inlineArrayType = types[i]->mobileType();
|
|
||||||
else if (inlineArrayType)
|
|
||||||
inlineArrayType = Type::commonType(inlineArrayType, types[i]);
|
|
||||||
}
|
}
|
||||||
if (!components[i]->annotation().isPure)
|
|
||||||
isPure = false;
|
// Note: code generation will visit each of the expression even if they are not assigned from.
|
||||||
|
if (types[i]->category() == Type::Category::RationalNumber && components.size() > 1)
|
||||||
|
if (!dynamic_cast<RationalNumberType const&>(*types[i]).mobileType())
|
||||||
|
m_errorReporter.fatalTypeError(components[i]->location(), "Invalid rational number.");
|
||||||
|
|
||||||
|
if (_tuple.isInlineArray())
|
||||||
|
{
|
||||||
|
solAssert(!!types[i], "Inline array cannot have empty components");
|
||||||
|
|
||||||
|
if ((i == 0 || inlineArrayType) && !types[i]->mobileType())
|
||||||
|
m_errorReporter.fatalTypeError(components[i]->location(), "Invalid mobile type.");
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
inlineArrayType = types[i]->mobileType();
|
||||||
|
else if (inlineArrayType)
|
||||||
|
inlineArrayType = Type::commonType(inlineArrayType, types[i]);
|
||||||
}
|
}
|
||||||
else
|
if (!components[i]->annotation().isPure)
|
||||||
types.push_back(TypePointer());
|
isPure = false;
|
||||||
}
|
}
|
||||||
_tuple.annotation().isPure = isPure;
|
_tuple.annotation().isPure = isPure;
|
||||||
if (_tuple.isInlineArray())
|
if (_tuple.isInlineArray())
|
||||||
|
Loading…
Reference in New Issue
Block a user