forked from qt-creator/qt-creator
QmlDesigner: Use proper features of std::variant instead of overloads
Change-Id: I6423155701b92d09011aaf913d845fa59148b207 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -84,15 +84,6 @@ inline bool isAcceptedIfBinaryOperator(const int &operation)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool areOfTheSameTypeMatch(const MatchedStatement &m1, const MatchedStatement &m2)
|
|
||||||
{
|
|
||||||
return std::visit(Overload{[](auto m1, auto m2) -> bool {
|
|
||||||
return std::is_same<decltype(m1), decltype(m2)>();
|
|
||||||
}},
|
|
||||||
m1,
|
|
||||||
m2);
|
|
||||||
}
|
|
||||||
|
|
||||||
class NodeStatus
|
class NodeStatus
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1071,19 +1062,12 @@ void ConnectionEditorEvaluator::endVisit(QmlJS::AST::IfStatement *ifStatement)
|
|||||||
if (status() != UnFinished)
|
if (status() != UnFinished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::visit(Overload{[this](const ConnectionEditorStatements::ConditionalStatement &statement) {
|
if (auto statement = std::get_if<ConditionalStatement>(&d->m_handler)) {
|
||||||
if (!ConnectionEditorStatements::isEmptyStatement(statement.ok)
|
if (!isEmptyStatement(statement->ok) && !isEmptyStatement(statement->ko)) {
|
||||||
&& !ConnectionEditorStatements::isEmptyStatement(statement.ko)) {
|
if (statement->ok.index() != statement->ko.index())
|
||||||
qDebug() << Q_FUNC_INFO
|
d->checkValidityAndReturn(false, "Matched statements types are mismatched");
|
||||||
<< areOfTheSameTypeMatch(statement.ok, statement.ko);
|
}
|
||||||
if (!areOfTheSameTypeMatch(statement.ok, statement.ko)) {
|
}
|
||||||
d->checkValidityAndReturn(
|
|
||||||
false, "Matched statements types are mismatched");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[](auto) {}},
|
|
||||||
d->m_handler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionEditorEvaluator::endVisit(QmlJS::AST::StatementList *statementList)
|
void ConnectionEditorEvaluator::endVisit(QmlJS::AST::StatementList *statementList)
|
||||||
|
Reference in New Issue
Block a user