Commit 35e787e6 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlJS Rewriter: Unify method names

changeProperty->changeBinding
removeProperty->removeBindingByName
parent 74e8027a
......@@ -229,10 +229,10 @@ QString Rewriter::flatten(UiQualifiedId *first)
return flatId;
}
void Rewriter::changeProperty(UiObjectInitializer *ast,
const QString &propertyName,
const QString &newValue,
BindingType binding)
void Rewriter::changeBinding(UiObjectInitializer *ast,
const QString &propertyName,
const QString &newValue,
BindingType binding)
{
QString prefix, suffix;
int dotIdx = propertyName.indexOf(QLatin1Char('.'));
......@@ -269,7 +269,7 @@ void Rewriter::changeProperty(UiObjectInitializer *ast,
else if (!prefix.isEmpty()) {
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) {
if (flatten(def->qualifiedTypeNameId) == prefix) {
changeProperty(def->initializer, suffix, newValue, binding);
changeBinding(def->initializer, suffix, newValue, binding);
}
}
}
......@@ -357,7 +357,7 @@ void Rewriter::insertIntoArray(UiArrayBinding *ast, const QString &newValue)
m_changeSet->insert(insertionPoint, QLatin1String(",\n") + newValue);
}
void Rewriter::removeProperty(UiObjectInitializer *ast, const QString &propertyName)
void Rewriter::removeBindingByName(UiObjectInitializer *ast, const QString &propertyName)
{
QString prefix;
int dotIdx = propertyName.indexOf(QLatin1Char('.'));
......
......@@ -55,27 +55,30 @@ public:
const QStringList &propertyOrder);
Range addBinding(AST::UiObjectInitializer *ast,
const QString &propertyName,
const QString &propertyValue,
BindingType bindingType);
const QString &propertyName,
const QString &propertyValue,
BindingType bindingType);
Range addBinding(AST::UiObjectInitializer *ast,
const QString &propertyName,
const QString &propertyValue,
BindingType bindingType,
AST::UiObjectMemberList *insertAfter);
const QString &propertyName,
const QString &propertyValue,
BindingType bindingType,
AST::UiObjectMemberList *insertAfter);
void changeProperty(AST::UiObjectInitializer *ast,
const QString &propertyName,
const QString &newValue,
BindingType binding);
void changeBinding(AST::UiObjectInitializer *ast,
const QString &propertyName,
const QString &newValue,
BindingType binding);
void removeProperty(AST::UiObjectInitializer *ast, const QString &propertyName);
void removeBindingByName(AST::UiObjectInitializer *ast, const QString &propertyName);
void appendToArrayBinding(AST::UiArrayBinding *arrayBinding,
const QString &content);
Range addObject(AST::UiObjectInitializer *ast, const QString &content);
Range addObject(AST::UiObjectInitializer *ast, const QString &content, AST::UiObjectMemberList *insertAfter);
void removeObjectMember(AST::UiObjectMember *member, AST::UiObjectMember *parent);
static AST::UiObjectMemberList *searchMemberToInsertAfter(AST::UiObjectMemberList *members, const QStringList &propertyOrder);
......
......@@ -199,7 +199,7 @@ void QmlContextPane::setProperty(const QString &propertyName, const QVariant &va
PropertyReader propertyReader(m_doc, initializer);
if (propertyReader.hasProperty(propertyName)) {
rewriter.changeProperty(initializer, propertyName, stringValue, bindingType);
rewriter.changeBinding(initializer, propertyName, stringValue, bindingType);
} else {
rewriter.addBinding(initializer, propertyName, stringValue, bindingType);
}
......@@ -249,7 +249,7 @@ void QmlContextPane::removeProperty(const QString &propertyName)
if (propertyReader.hasProperty(propertyName)) {
Utils::ChangeSet changeSet;
Rewriter rewriter(m_doc->source(), &changeSet, m_propertyOrder);
rewriter.removeProperty(initializer, propertyName);
rewriter.removeBindingByName(initializer, propertyName);
QTextCursor tc(m_editor->editor()->document());
changeSet.apply(&tc);
}
......
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