From: Aaron Kennedy Date: Wed, 5 Oct 2011 07:32:05 +0000 (+1000) Subject: Set isRoot correctly for value types X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=17aa5272d8f20f3e64e3bcb5c1c5bb1af8e1c7f2;p=konrad%2Fqtdeclarative.git Set isRoot correctly for value types Change-Id: I1ddbe5a76fd804df51a3feaf1c0a9004a67abf9f Reviewed-on: http://codereview.qt-project.org/6023 Reviewed-by: Qt Sanity Bot Reviewed-by: Aaron Kennedy --- diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 69df595..dc992b5 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -3118,13 +3118,15 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeScript::Value *bindi store.value = ref.compiledIndex; store.context = ref.bindingContext.stack; store.owner = ref.bindingContext.owner; - if (valueTypeProperty) + if (valueTypeProperty) { store.property = (valueTypeProperty->index & 0xFFFF) | ((valueTypeProperty->type & 0xFF)) << 16 | ((prop->index & 0xFF) << 24); - else + store.isRoot = (compileState->root == valueTypeProperty->parent); + } else { store.property = prop->index; - store.isRoot = (compileState->root == obj); + store.isRoot = (compileState->root == obj); + } store.line = binding->location.start.line; output->addInstruction(store); } else if (ref.dataType == BindingReference::V8) { @@ -3132,7 +3134,11 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeScript::Value *bindi store.value = ref.compiledIndex; store.context = ref.bindingContext.stack; store.owner = ref.bindingContext.owner; - store.isRoot = (compileState->root == obj); + if (valueTypeProperty) { + store.isRoot = (compileState->root == valueTypeProperty->parent); + } else { + store.isRoot = (compileState->root == obj); + } store.line = binding->location.start.line; Q_ASSERT(ref.bindingContext.owner == 0 || @@ -3149,9 +3155,14 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeScript::Value *bindi store.assignBinding.value = output->indexForString(ref.rewrittenExpression); store.assignBinding.context = ref.bindingContext.stack; store.assignBinding.owner = ref.bindingContext.owner; - store.assignBinding.isRoot = (compileState->root == obj); store.assignBinding.line = binding->location.start.line; + if (valueTypeProperty) { + store.assignBinding.isRoot = (compileState->root == valueTypeProperty->parent); + } else { + store.assignBinding.isRoot = (compileState->root == obj); + } + Q_ASSERT(ref.bindingContext.owner == 0 || (ref.bindingContext.owner != 0 && valueTypeProperty)); if (ref.bindingContext.owner) {