}
}
+QQmlPropertyData *QObjectWrapper::findProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local) const
+{
+ QHashedV4String propertystring(QV4::Value::fromString(name));
+
+ QQmlData *ddata = QQmlData::get(m_object, false);
+ if (!ddata)
+ return 0;
+ if (ddata && ddata->propertyCache)
+ return ddata->propertyCache->property(propertystring, m_object, qmlContext);
+ else
+ return QQmlPropertyCache::property(engine->v8Engine->engine(), m_object, propertystring, qmlContext, *local);
+}
+
Value QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, String *name, QObjectWrapper::RevisionMode revisionMode, bool *hasProperty, bool includeImports)
{
if (QQmlData::wasDeleted(m_object)) {
return method;
}
- QHashedV4String propertystring(QV4::Value::fromString(name));
- QV8Engine *v8Engine = ctx->engine->v8Engine;
-
- QQmlData *ddata = QQmlData::get(m_object, false);
QQmlPropertyData local;
- QQmlPropertyData *result = 0;
- {
- QHashedV4String propertystring(Value::fromString(name));
- if (ddata && ddata->propertyCache)
- result = ddata->propertyCache->property(propertystring, m_object, qmlContext);
- else
- result = QQmlPropertyCache::property(ctx->engine->v8Engine->engine(), m_object, propertystring, qmlContext, local);
- }
+ QQmlPropertyData *result = findProperty(ctx->engine, qmlContext, name, revisionMode, &local);
if (!result) {
if (includeImports && name->startsWithUpper()) {
// Check for attached properties
if (qmlContext && qmlContext->imports) {
+ QHashedV4String propertystring(QV4::Value::fromString(name));
QQmlTypeNameCache::Result r = qmlContext->imports->query(propertystring);
if (hasProperty)
if (r.scriptIndex != -1) {
return QV4::Value::undefinedValue();
} else if (r.type) {
- return QmlTypeWrapper::create(v8Engine, m_object, r.type, QmlTypeWrapper::ExcludeEnums);
+ return QmlTypeWrapper::create(ctx->engine->v8Engine, m_object, r.type, QmlTypeWrapper::ExcludeEnums);
} else if (r.importNamespace) {
- return QmlTypeWrapper::create(v8Engine, m_object, qmlContext->imports, r.importNamespace, QmlTypeWrapper::ExcludeEnums);
+ return QmlTypeWrapper::create(ctx->engine->v8Engine, m_object, qmlContext->imports, r.importNamespace, QmlTypeWrapper::ExcludeEnums);
}
Q_ASSERT(!"Unreachable");
}
}
QQmlData::flushPendingBinding(m_object, result->coreIndex);
+ QQmlData *ddata = QQmlData::get(m_object, false);
if (revisionMode == QV4::QObjectWrapper::CheckRevision && result->hasRevision()) {
if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result)) {
}
}
+PropertyAttributes QObjectWrapper::query(const Managed *m, String *name)
+{
+ const QObjectWrapper *that = static_cast<const QObjectWrapper*>(m);
+ ExecutionEngine *engine = that->engine();
+ QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(engine);
+ QQmlPropertyData local;
+ if (that->findProperty(engine, qmlContext, name, IgnoreRevision, &local)
+ || name->isEqualTo(that->m_destroy) || name->isEqualTo(that->m_toString))
+ return QV4::Attr_Data;
+ else
+ return QV4::Object::query(m, name);
+}
+
QV4::Value QObjectWrapper::enumerateProperties(Object *object)
{
QObjectWrapper *that = static_cast<QObjectWrapper*>(object);
class QObject;
class QQmlData;
class QQmlPropertyCache;
+class QQmlPropertyData;
namespace QV4 {
struct QObjectSlotDispatcher;
QObjectWrapper(ExecutionEngine *engine, QObject *object);
+ QQmlPropertyData *findProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local) const;
+
QQmlGuard<QObject> m_object;
String *m_destroy;
String *m_toString;
static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty);
static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
+ static PropertyAttributes query(const Managed *, String *name);
static void markObjects(Managed *that);
static Value enumerateProperties(Object *m_object);