Commit 6559ec7d authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Cleanup.

parent 1952f06c
......@@ -331,6 +331,10 @@ static QString propertyName(UiQualifiedId *id)
void Delta::operator()(Document::Ptr doc, Document::Ptr previousDoc)
{
_doc = doc;
_previousDoc = previousDoc;
_changes.clear();
const QUrl url = QUrl::fromLocalFile(doc->fileName());
ScriptBindingParser bindingParser(doc, ClientProxy::instance()->objectReferences(url));
bindingParser.process();
......@@ -399,18 +403,26 @@ void Delta::operator()(Document::Ptr doc, Document::Ptr previousDoc)
}
void Delta::updateScriptBinding(const QDeclarativeDebugObjectReference &objectReference,
UiScriptBinding *scriptBinding, const QString &propertyName, const QString &scriptCode)
UiScriptBinding *scriptBinding,
const QString &propertyName,
const QString &scriptCode)
{
qDebug() << "update script:" << propertyName << scriptCode << scriptBinding;
QVariant expr = scriptCode;
//qDebug() << " " << scriptBinding->statement->kind << typeid(*scriptBinding->statement).name();
bool isLiteral = isLiteralValue(scriptBinding);
const bool isLiteral = isLiteralValue(scriptBinding);
if (isLiteral)
expr = castToLiteral(scriptCode, scriptBinding);
ClientProxy::instance()->setBindingForObject(objectReference.debugId(), propertyName, expr, isLiteral);
Change change;
change.script = scriptBinding;
change.ref = objectReference;
change.isLiteral = isLiteral;
_changes.append(change);
ClientProxy::instance()->setBindingForObject(objectReference.debugId(), propertyName, expr, isLiteral); // ### remove
}
bool Delta::compare(UiQualifiedId *id, UiQualifiedId *other)
......@@ -437,3 +449,18 @@ UiObjectMemberList *Delta::objectMembers(UiObjectMember *object)
return 0;
}
Document::Ptr Delta::document() const
{
return _doc;
}
Document::Ptr Delta::previousDocument() const
{
return _previousDoc;
}
QList<Delta::Change> Delta::changes() const
{
return _changes;
}
......@@ -40,9 +40,23 @@ namespace Internal {
class Delta
{
public:
struct Change {
Change(): script(0), isLiteral(false) {}
QmlJS::AST::UiScriptBinding *script;
bool isLiteral;
QDeclarativeDebugObjectReference ref;
};
public:
void operator()(QmlJS::Document::Ptr doc, QmlJS::Document::Ptr previousDoc);
QList<Change> changes() const;
QmlJS::Document::Ptr document() const;
QmlJS::Document::Ptr previousDocument() const;
private:
void updateScriptBinding(const QDeclarativeDebugObjectReference &objectReference,
QmlJS::AST::UiScriptBinding *scriptBinding,
......@@ -51,6 +65,11 @@ private:
bool compare(QmlJS::AST::UiQualifiedId *id, QmlJS::AST::UiQualifiedId *other);
QmlJS::AST::UiObjectMemberList *objectMembers(QmlJS::AST::UiObjectMember *object);
private:
QmlJS::Document::Ptr _doc;
QmlJS::Document::Ptr _previousDoc;
QList<Change> _changes;
};
} // namespace Internal
......
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