+}
+
+static inline bool expressions_to_run(QDeclarativeContextData *ctxt, bool isGlobalRefresh)
+{
+ return ctxt->expressions && (!isGlobalRefresh || ctxt->unresolvedNames);
+}
+
+void QDeclarativeContextData::refreshExpressionsRecursive(bool isGlobal)
+{
+ // For efficiency, we try and minimize the number of guards we have to create
+ if (expressions_to_run(this, isGlobal) && (nextChild || childContexts)) {
+ QDeclarativeGuardedContextData guard(this);
+
+ if (childContexts)
+ childContexts->refreshExpressionsRecursive(isGlobal);
+
+ if (guard.isNull()) return;
+
+ if (nextChild)
+ nextChild->refreshExpressionsRecursive(isGlobal);
+
+ if (guard.isNull()) return;
+
+ if (expressions_to_run(this, isGlobal))
+ refreshExpressionsRecursive(expressions);
+
+ } else if (expressions_to_run(this, isGlobal)) {
+
+ refreshExpressionsRecursive(expressions);
+
+ } else if (nextChild && childContexts) {
+
+ QDeclarativeGuardedContextData guard(this);
+
+ childContexts->refreshExpressionsRecursive(isGlobal);
+
+ if (!guard.isNull() && nextChild)
+ nextChild->refreshExpressionsRecursive(isGlobal);
+
+ } else if (nextChild) {
+
+ nextChild->refreshExpressionsRecursive(isGlobal);
+
+ } else if (childContexts) {
+
+ childContexts->refreshExpressionsRecursive(isGlobal);
+
+ }
+}
+
+// Refreshes all expressions that could possibly depend on this context. Refreshing flushes all
+// context-tree dependent caches in the expressions, and should occur every time the context tree
+// *structure* (not values) changes.
+void QDeclarativeContextData::refreshExpressions()
+{
+ bool isGlobal = (parent == 0);
+
+ // For efficiency, we try and minimize the number of guards we have to create
+ if (expressions_to_run(this, isGlobal) && childContexts) {
+ QDeclarativeGuardedContextData guard(this);
+
+ childContexts->refreshExpressionsRecursive(isGlobal);
+
+ if (!guard.isNull() && expressions_to_run(this, isGlobal))
+ refreshExpressionsRecursive(expressions);
+
+ } else if (expressions_to_run(this, isGlobal)) {
+
+ refreshExpressionsRecursive(expressions);
+
+ } else if (childContexts) {
+
+ childContexts->refreshExpressionsRecursive(isGlobal);
+