aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypewrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-18 15:34:13 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-22 01:06:20 +0200
commit700ba1bcb39e082049c96fafdfaccfe5d83cd77e (patch)
treed21da27b94a927377ba2c6efd7c3af731d890b19 /src/qml/qml/qqmltypewrapper.cpp
parent1aa618970a9bed46123d0648500e957688d725ec (diff)
Use a StringRef for Managed::get()
also store "toString" and "valueOf" as identifiers in the engine and fix two places where we compared strings the wrong way. Change-Id: I70612221e72d43ed0e3c496e4209681bf254cded Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmltypewrapper.cpp')
-rw-r--r--src/qml/qml/qqmltypewrapper.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp
index 09ef732e2d..f7e831cb80 100644
--- a/src/qml/qml/qqmltypewrapper.cpp
+++ b/src/qml/qml/qqmltypewrapper.cpp
@@ -112,7 +112,7 @@ ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlTypeNameCach
}
-ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
+ReturnedValue QmlTypeWrapper::get(Managed *m, const StringRef name, bool *hasProperty)
{
QV4::ExecutionEngine *v4 = m->engine();
QV4::Scope scope(v4);
@@ -158,7 +158,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
}
// check for property.
- return QV4::QObjectWrapper::getQmlProperty(v4->current, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);
+ return QV4::QObjectWrapper::getQmlProperty(v4->current, context, qobjectSingleton, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, hasProperty);
} else if (!siinfo->scriptApi(e).isUndefined()) {
QV4::ExecutionEngine *engine = QV8Engine::getV4(v8engine);
// NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
@@ -182,7 +182,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
} else if (w->object) {
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
if (ao)
- return QV4::QObjectWrapper::getQmlProperty(v4->current, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);
+ return QV4::QObjectWrapper::getQmlProperty(v4->current, context, ao, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, hasProperty);
// Fall through to base implementation
}
@@ -263,8 +263,10 @@ void QmlTypeWrapper::put(Managed *m, String *name, const Value &value)
PropertyAttributes QmlTypeWrapper::query(const Managed *m, String *name)
{
// ### Implement more efficiently.
+ Scope scope(m->engine());
+ ScopedString n(scope, name);
bool hasProperty = false;
- const_cast<Managed*>(m)->get(name, &hasProperty);
+ const_cast<Managed*>(m)->get(n, &hasProperty);
return hasProperty ? Attr_Data : Attr_Invalid;
}