diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-12 19:43:14 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-09-14 10:07:31 +0000 |
commit | 53afbba6dc95e69a13b99e8035fd35582ef952e4 (patch) | |
tree | cc8596b4cf9d17c2694a436943b55778f82e6545 /src/qml/jsruntime/qv4string_p.h | |
parent | 69359ed4e500081d39bdc0436afa1f7e5f8fdd9d (diff) |
Inline StringOrSymbol::toPropertyKey()
Save some instructions when converting a Stirng to a property
key.
Change-Id: Ide05ba8a54b504f5e606bdcdab53a2a0afeb9436
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4string_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4string_p.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h index 6a69c830ea..fbd4f5f550 100644 --- a/src/qml/jsruntime/qv4string_p.h +++ b/src/qml/jsruntime/qv4string_p.h @@ -306,12 +306,17 @@ struct ComplexString : String { inline void StringOrSymbol::createPropertyKey() const { - if (d()->identifier.isValid()) - return; + Q_ASSERT(!d()->identifier.isValid()); Q_ASSERT(isString()); static_cast<const String *>(this)->createPropertyKeyImpl(); } +inline PropertyKey StringOrSymbol::toPropertyKey() const { + if (!d()->identifier.isValid()) + createPropertyKey(); + return d()->identifier; +} + template<> inline const StringOrSymbol *Value::as() const { return isManaged() && m()->internalClass->vtable->isStringOrSymbol ? static_cast<const String *>(this) : nullptr; |