This commit is contained in:
Roberto Raggi
2010-06-29 15:45:30 +02:00
parent 1952f06c4e
commit 6559ec7d79
2 changed files with 49 additions and 3 deletions

View File

@@ -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;
}