Commit 7ee5ea0a authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Fixed action compression to catch symmetric property additions/removals.

Task-number: QTCREATORBUG-3664
parent f5b82c4f
......@@ -226,7 +226,7 @@ void RewriteActionCompressor::compressPropertyActions(QList<RewriteAction *> &ac
QList<RewriteAction *> actionsToRemove;
QHash<AbstractProperty, RewriteAction *> removedProperties;
QHash<AbstractProperty, ChangePropertyRewriteAction *> changedProperties;
QSet<AbstractProperty> addedProperties;
QHash<AbstractProperty, AddPropertyRewriteAction *> addedProperties;
QMutableListIterator<RewriteAction*> iter(actions);
iter.toBack();
......@@ -234,7 +234,14 @@ void RewriteActionCompressor::compressPropertyActions(QList<RewriteAction *> &ac
RewriteAction *action = iter.previous();
if (RemovePropertyRewriteAction *removeAction = action->asRemovePropertyRewriteAction()) {
removedProperties.insert(removeAction->property(), action);
const AbstractProperty property = removeAction->property();
if (AddPropertyRewriteAction *addAction = addedProperties.value(property, 0)) {
actionsToRemove.append(addAction);
actionsToRemove.append(removeAction);
addedProperties.remove(property);
} else {
removedProperties.insert(property, action);
}
} else if (ChangePropertyRewriteAction *changeAction = action->asChangePropertyRewriteAction()) {
const AbstractProperty property = changeAction->property();
......@@ -257,7 +264,7 @@ void RewriteActionCompressor::compressPropertyActions(QList<RewriteAction *> &ac
if (changedProperties.contains(property))
changedProperties.remove(property);
addedProperties.insert(property);
addedProperties.insert(property, addAction);
}
}
}
......
......@@ -623,7 +623,11 @@ void RewriterView::qmlTextChanged()
if (m_textToModelMerger && m_textModifier) {
const QString newQmlText = m_textModifier->text();
// qDebug() << "qmlTextChanged:" << newQmlText;
#if 0
qDebug() << Q_FUNC_INFO;
qDebug() << "old:" << lastCorrectQmlSource;
qDebug() << "new:" << newQmlText;
#endif
switch (m_differenceHandling) {
case Validate: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment