/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qdeclarativecontext.h"
-#include "private/qdeclarativedata_p.h"
-#include "private/qdeclarativeintegercache_p.h"
-#include "private/qdeclarativetypenamecache_p.h"
-#include "private/qdeclarativenotifier_p.h"
+#include "qdeclarativedata_p.h"
+#include "qdeclarativeintegercache_p.h"
+#include "qdeclarativetypenamecache_p.h"
+#include "qdeclarativenotifier_p.h"
#include "qdeclarativelist.h"
-#include "private/qdeclarativeparser_p.h"
+#include "qdeclarativescript_p.h"
#include <QtCore/qhash.h>
#include <QtDeclarative/qjsvalue.h>
#include <QtCore/qset.h>
#include <private/qobject_p.h>
-#include "private/qdeclarativeguard_p.h"
+#include <private/qflagpointer_p.h>
+#include <private/qdeclarativeguard_p.h>
#include <private/qv8_p.h>
+
QT_BEGIN_NAMESPACE
class QV8Bindings;
class QDeclarativeExpression;
class QDeclarativeExpressionPrivate;
class QDeclarativeAbstractExpression;
-class QDeclarativeV4Bindings;
+class QV4Bindings;
class QDeclarativeContextData;
class QDeclarativeContextPrivate : public QObjectPrivate
static QObject *context_at(QDeclarativeListProperty<QObject> *, int);
};
+class QDeclarativeVME;
class QDeclarativeComponentAttached;
class QDeclarativeGuardedContextData;
class Q_DECLARATIVE_EXPORT QDeclarativeContextData
quint32 ownedByParent:1; // unrelated to isInternal; parent context deletes children if true.
quint32 isJSContext:1;
quint32 isPragmaLibraryContext:1;
+ quint32 unresolvedNames:1; // True if expressions in this context failed to resolve a toplevel name
quint32 dummy:28;
QDeclarativeContext *publicContext;
+ // VME data that is constructing this context if any
+ void *activeVMEData;
+
// Property name cache
QDeclarativeIntegerCache *propertyNames;
// id guards
struct ContextGuard : public QDeclarativeGuard<QObject>
{
- ContextGuard() : context(0) {}
- inline ContextGuard &operator=(QObject *obj)
- { QDeclarativeGuard<QObject>::operator=(obj); return *this; }
- virtual void objectDestroyed(QObject *) {
- if (context->contextObject && !QObjectPrivate::get(context->contextObject)->wasDeleted) bindings.notify();
- }
- QDeclarativeContextData *context;
+ inline ContextGuard();
+ inline ContextGuard &operator=(QObject *obj);
+ inline void objectDestroyed(QObject *);
+
+ inline bool wasSet() const;
+
+ QFlagPointer<QDeclarativeContextData> context;
QDeclarativeNotifier bindings;
};
ContextGuard *idValues;
QDeclarativeComponentAttached *componentAttached;
// Optimized binding objects. Needed for deferred properties.
- QDeclarativeV4Bindings *v4bindings;
+ QV4Bindings *v4bindings;
QV8Bindings *v8bindings;
// Return the outermost id for obj, if any.
}
private:
+ void refreshExpressionsRecursive(bool isGlobal);
+ void refreshExpressionsRecursive(QDeclarativeAbstractExpression *);
~QDeclarativeContextData() {}
};
return *this;
}
+QDeclarativeContextData::ContextGuard::ContextGuard()
+: context(0)
+{
+}
+
+QDeclarativeContextData::ContextGuard &QDeclarativeContextData::ContextGuard::operator=(QObject *obj)
+{
+ QDeclarativeGuard<QObject>::operator=(obj);
+ context.setFlag();
+ bindings.notify(); // For alias connections
+ return *this;
+}
+
+void QDeclarativeContextData::ContextGuard::objectDestroyed(QObject *)
+{
+ if (context->contextObject && !QObjectPrivate::get(context->contextObject)->wasDeleted)
+ bindings.notify();
+}
+
+bool QDeclarativeContextData::ContextGuard::wasSet() const
+{
+ return context.flag();
+}
+
QT_END_NAMESPACE
#endif // QDECLARATIVECONTEXT_P_H