diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-23 20:08:40 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-07-02 19:29:32 +0000 |
commit | 56602df447c5f16257874f2e97b078dcf76f2467 (patch) | |
tree | 901c76eb6262dad80e6ab94af810c645355cb6d5 /src/qml/qml | |
parent | db695c5b1d07275f208446dad178b1131b20bb0a (diff) |
Cleanups in the Identifier API
Rename from/asHeapObject to from/asStringOrSymbol and fix
the signature.
Add a isStringOrSymbol() method and redefine isValid() to also
include array indices.
Change-Id: Ic8272bfbe84d15421e2ebe86ddda7fdaa8db4f3e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmltypewrapper.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index a1bfc109da..2e28a9e222 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -176,7 +176,7 @@ ReturnedValue QQmlTypeWrapper::get(const Managed *m, Identifier id, const Value QV4::ExecutionEngine *v4 = static_cast<const QQmlTypeWrapper *>(m)->engine(); QV4::Scope scope(v4); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); Scoped<QQmlTypeWrapper> w(scope, static_cast<const QQmlTypeWrapper *>(m)); @@ -316,7 +316,7 @@ bool QQmlTypeWrapper::put(Managed *m, Identifier id, const Value &value, Value * if (scope.engine->hasException) return false; - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); QQmlContextData *context = scope.engine->callingQmlContext(); QQmlType type = w->d()->type(); @@ -354,7 +354,7 @@ PropertyAttributes QQmlTypeWrapper::getOwnProperty(Managed *m, Identifier id, Pr { if (id.isString()) { Scope scope(m); - ScopedString n(scope, id.asHeapObject()); + ScopedString n(scope, id.asStringOrSymbol()); // ### Implement more efficiently. bool hasProperty = false; static_cast<Object *>(m)->get(n, &hasProperty); @@ -437,7 +437,7 @@ ReturnedValue QQmlScopedEnumWrapper::get(const Managed *m, Identifier id, const const QQmlScopedEnumWrapper *resource = static_cast<const QQmlScopedEnumWrapper *>(m); QV4::ExecutionEngine *v4 = resource->engine(); QV4::Scope scope(v4); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); QQmlType type = resource->d()->type(); int index = resource->d()->scopeEnumIndex; diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index b1993da0a2..bd612221be 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -245,7 +245,7 @@ PropertyAttributes QQmlValueTypeWrapper::getOwnProperty(Managed *m, Identifier i { if (id.isString()) { Scope scope(m); - ScopedString n(scope, id.asHeapObject()); + ScopedString n(scope, id.asStringOrSymbol()); const QQmlValueTypeWrapper *r = static_cast<const QQmlValueTypeWrapper *>(m); QQmlPropertyData *result = r->d()->propertyCache()->property(n.getPointer(), nullptr, nullptr); return result ? Attr_Data : Attr_Invalid; @@ -369,7 +369,7 @@ ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, Identifier id, const V const QQmlValueTypeWrapper *r = static_cast<const QQmlValueTypeWrapper *>(m); QV4::ExecutionEngine *v4 = r->engine(); Scope scope(v4); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); // Note: readReferenceValue() can change the reference->type. if (const QQmlValueTypeReference *reference = r->as<QQmlValueTypeReference>()) { @@ -448,7 +448,7 @@ bool QQmlValueTypeWrapper::put(Managed *m, Identifier id, const Value &value, Va writeBackPropertyType = writebackProperty.userType(); } - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); const QMetaObject *metaObject = r->d()->propertyCache()->metaObject(); const QQmlPropertyData *pd = r->d()->propertyCache()->property(name.getPointer(), nullptr, nullptr); diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index f99c4def45..6b6449c20e 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -207,7 +207,7 @@ void QV8Engine::initializeGlobal() { for (uint i = 0; i < m_v4Engine->globalObject->internalClass()->size; ++i) { - if (m_v4Engine->globalObject->internalClass()->nameMap.at(i).isValid()) { + if (m_v4Engine->globalObject->internalClass()->nameMap.at(i).isString()) { QV4::Identifier id = m_v4Engine->globalObject->internalClass()->nameMap.at(i); m_illegalNames.insert(id.toQString()); } @@ -241,7 +241,7 @@ static void freeze_recursive(QV4::ExecutionEngine *v4, QV4::Object *object) QV4::ScopedObject o(scope); for (uint i = 0; i < frozen->size; ++i) { - if (!frozen->nameMap.at(i).isValid()) + if (!frozen->nameMap.at(i).isStringOrSymbol()) continue; o = *object->propertyData(i); if (o) |