Commit fb1ae302 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

qmljsrewriter: adapt rewriter to ChangeSet api changes

parent 61e6873a
...@@ -127,7 +127,7 @@ void Rewriter::addBinding(AST::UiObjectInitializer *ast, ...@@ -127,7 +127,7 @@ void Rewriter::addBinding(AST::UiObjectInitializer *ast,
newPropertyTemplate.prepend(QLatin1Char('\n')); newPropertyTemplate.prepend(QLatin1Char('\n'));
} }
m_changeSet->replace(endOfPreviousMember.end(), 0, m_changeSet->insert(endOfPreviousMember.end(),
newPropertyTemplate.arg(propertyName, propertyValue)); newPropertyTemplate.arg(propertyName, propertyValue));
} }
...@@ -302,7 +302,7 @@ void Rewriter::replaceMemberValue(UiObjectMember *propertyMember, ...@@ -302,7 +302,7 @@ void Rewriter::replaceMemberValue(UiObjectMember *propertyMember,
if (needsSemicolon) if (needsSemicolon)
replacement += ';'; replacement += ';';
m_changeSet->replace(startOffset, endOffset - startOffset, replacement); m_changeSet->replace(startOffset, endOffset, replacement);
} }
bool Rewriter::isMatchingPropertyMember(const QString &propertyName, bool Rewriter::isMatchingPropertyMember(const QString &propertyName,
...@@ -343,7 +343,7 @@ void Rewriter::insertIntoArray(UiArrayBinding *ast, const QString &newValue) ...@@ -343,7 +343,7 @@ void Rewriter::insertIntoArray(UiArrayBinding *ast, const QString &newValue)
return; return;
const int insertionPoint = lastMember->lastSourceLocation().end(); const int insertionPoint = lastMember->lastSourceLocation().end();
m_changeSet->replace(insertionPoint, 0, QLatin1String(",\n") + newValue); m_changeSet->insert(insertionPoint, QLatin1String(",\n") + newValue);
} }
void Rewriter::removeProperty(UiObjectInitializer *ast, const QString &propertyName) void Rewriter::removeProperty(UiObjectInitializer *ast, const QString &propertyName)
...@@ -406,7 +406,7 @@ void Rewriter::removeMember(UiObjectMember *member) ...@@ -406,7 +406,7 @@ void Rewriter::removeMember(UiObjectMember *member)
includeSurroundingWhitespace(start, end); includeSurroundingWhitespace(start, end);
m_changeSet->replace(start, end - start, QLatin1String("")); m_changeSet->replace(start, end, QLatin1String(""));
} }
bool Rewriter::includeSurroundingWhitespace(int &start, int &end) const bool Rewriter::includeSurroundingWhitespace(int &start, int &end) const
...@@ -558,7 +558,7 @@ void Rewriter::appendToArrayBinding(UiArrayBinding *arrayBinding, ...@@ -558,7 +558,7 @@ void Rewriter::appendToArrayBinding(UiArrayBinding *arrayBinding,
const int insertionPoint = lastMember->lastSourceLocation().end(); const int insertionPoint = lastMember->lastSourceLocation().end();
m_changeSet->replace(insertionPoint, 0, QLatin1String(",\n") + content); m_changeSet->insert(insertionPoint, QLatin1String(",\n") + content);
} }
void Rewriter::addObject(UiObjectInitializer *ast, const QString &content) void Rewriter::addObject(UiObjectInitializer *ast, const QString &content)
...@@ -575,7 +575,7 @@ void Rewriter::addObject(UiObjectInitializer *ast, const QString &content) ...@@ -575,7 +575,7 @@ void Rewriter::addObject(UiObjectInitializer *ast, const QString &content)
} }
textToInsert += content; textToInsert += content;
m_changeSet->replace(insertionPoint, 0, QLatin1String("\n") + textToInsert); m_changeSet->insert(insertionPoint, QLatin1String("\n") + textToInsert);
} }
void Rewriter::removeObjectMember(UiObjectMember *member, UiObjectMember *parent) void Rewriter::removeObjectMember(UiObjectMember *member, UiObjectMember *parent)
...@@ -590,7 +590,7 @@ void Rewriter::removeObjectMember(UiObjectMember *member, UiObjectMember *parent ...@@ -590,7 +590,7 @@ void Rewriter::removeObjectMember(UiObjectMember *member, UiObjectMember *parent
} }
includeLeadingEmptyLine(start); includeLeadingEmptyLine(start);
m_changeSet->replace(start, end - start, QLatin1String("")); m_changeSet->replace(start, end, QLatin1String(""));
} }
void Rewriter::extendToLeadingOrTrailingComma(UiArrayBinding *parentArray, void Rewriter::extendToLeadingOrTrailingComma(UiArrayBinding *parentArray,
......
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