aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qmlcontext.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-04-15 10:11:43 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-04-15 11:14:19 +0200
commit221b2789dbc64520c97bf39a7d8465780c6fddfc (patch)
tree6cb0604ec881a1fec0a13abcf2663294dd530802 /src/qml/jsruntime/qv4qmlcontext.cpp
parent198120212285e4cda45caaf0c32c15c25eddc6c8 (diff)
Streamline retrieval of context property names and IDs
Most of this can be inline, and we never need to copy the actual identifier hash. Change-Id: I6468b6b1a571e4854c00c865a2aa57c3b2f0ca8c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qmlcontext.cpp')
-rw-r--r--src/qml/jsruntime/qv4qmlcontext.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp
index 18d611f2c3..f845f1d6e5 100644
--- a/src/qml/jsruntime/qv4qmlcontext.cpp
+++ b/src/qml/jsruntime/qv4qmlcontext.cpp
@@ -88,11 +88,7 @@ static OptionalReturnedValue searchContextProperties(
bool *hasProperty, Value *base, QV4::Lookup *lookup, QV4::Lookup *originalLookup,
QQmlEnginePrivate *ep)
{
- const QV4::IdentifierHash &properties = context->propertyNames();
- if (properties.count() == 0)
- return OptionalReturnedValue();
-
- const int propertyIdx = properties.value(name);
+ const int propertyIdx = context->propertyIndex(name);
if (propertyIdx == -1)
return OptionalReturnedValue();
@@ -429,17 +425,13 @@ bool QQmlContextWrapper::virtualPut(Managed *m, PropertyKey id, const Value &val
ScopedString name(scope, id.asStringOrSymbol());
while (context) {
- const QV4::IdentifierHash &properties = context->propertyNames();
// Search context properties
- if (properties.count()) {
- const int propertyIndex = properties.value(name);
- if (propertyIndex != -1) {
- if (propertyIndex < context->numIdValues()) {
- v4->throwError(QLatin1String("left-hand side of assignment operator is not an lvalue"));
- return false;
- }
+ if (const int propertyIndex = context->propertyIndex(name); propertyIndex != -1) {
+ if (propertyIndex < context->numIdValues()) {
+ v4->throwError(QLatin1String("left-hand side of assignment operator is not an lvalue"));
return false;
}
+ return false;
}
// Search scope object