aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4string_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-04-07 13:28:59 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:18:27 +0000
commitd1af494793961a31747b689cf307b65d99367486 (patch)
tree1e89898065334e841ded62499331274cb9d0b230 /src/qml/jsruntime/qv4string_p.h
parent3c090c80c58d99f1bd29493ef747a4f6fa915a71 (diff)
Change Objects vtable methods to take a StringOrSymbol
This is needed for symbol support. Change-Id: I83db21f232168710d18999fd97d912016e86d630 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4string_p.h')
-rw-r--r--src/qml/jsruntime/qv4string_p.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index 0a316d85b5..a1763522b5 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -160,6 +160,12 @@ struct Q_QML_PRIVATE_EXPORT StringOrSymbol : public Managed {
enum {
IsStringOrSymbol = true
};
+
+ inline void makeIdentifier() const;
+ Identifier identifier() const { return d()->identifier; }
+
+ uint asArrayIndex() const;
+
#endif
};
@@ -204,12 +210,6 @@ struct Q_QML_PRIVATE_EXPORT String : public StringOrSymbol {
}
uint toUInt(bool *ok) const;
- void makeIdentifier() const {
- if (d()->identifier.isValid())
- return;
- makeIdentifierImpl();
- }
-
// slow path
Q_NEVER_INLINE void makeIdentifierImpl() const;
@@ -227,8 +227,6 @@ struct Q_QML_PRIVATE_EXPORT String : public StringOrSymbol {
bool startsWithUpper() const { return d()->startsWithUpper(); }
- Identifier identifier() const { return d()->identifier; }
-
protected:
static bool isEqualTo(Managed *that, Managed *o);
static uint getLength(const Managed *m);
@@ -297,6 +295,21 @@ struct ComplexString : String {
}
};
+inline
+void StringOrSymbol::makeIdentifier() const {
+ if (d()->identifier.isValid())
+ return;
+ Q_ASSERT(isString());
+ static_cast<const String *>(this)->makeIdentifierImpl();
+}
+
+inline
+uint StringOrSymbol::asArrayIndex() const {
+ if (isString())
+ return static_cast<const String *>(this)->asArrayIndex();
+ return UINT_MAX;
+}
+
template<>
inline const StringOrSymbol *Value::as() const {
return isManaged() && m()->internalClass->vtable->isStringOrSymbol ? static_cast<const String *>(this) : nullptr;