diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-01-03 15:37:32 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-01-19 10:13:54 +0000 |
commit | 1fe206712755b0d99f91bc7897f0a705ec583f2d (patch) | |
tree | b5fee1288c60f8d9b60e7b5147ab7ebe4c6b1a2c /src/qml/jsruntime/qv4string_p.h | |
parent | 959ad9f998c340257a4027db4bed3a5639a8f48f (diff) |
Introduce a SubString String type
Use it in regexp matching. There's probably other places where
we should use this as well.
Change-Id: Ie2774acff0a5ec7b1c26c564fa40e65fecea29d4
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.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h index d1b38f4336..41039bca88 100644 --- a/src/qml/jsruntime/qv4string_p.h +++ b/src/qml/jsruntime/qv4string_p.h @@ -71,6 +71,7 @@ struct Q_QML_PRIVATE_EXPORT String : Base { StringType_ArrayIndex, StringType_Unknown, StringType_AddedString, + StringType_SubString, StringType_Complex = StringType_AddedString }; @@ -124,10 +125,13 @@ Q_STATIC_ASSERT(std::is_trivial< String >::value); #ifndef V4_BOOTSTRAP struct ComplexString : String { void init(String *l, String *n); - mutable uint nestingLevel; + void init(String *ref, int from, int len); mutable String *left; mutable String *right; - mutable int largestSubLength; + union { + mutable int largestSubLength; + int from; + }; int len; }; Q_STATIC_ASSERT(std::is_trivial< ComplexString >::value); @@ -172,7 +176,7 @@ struct Q_QML_PRIVATE_EXPORT String : public Managed { return d()->hashValue(); } uint asArrayIndex() const { - if (subtype() == Heap::String::StringType_Unknown) + if (subtype() >= Heap::String::StringType_Unknown) d()->createHashValue(); Q_ASSERT(d()->subtype < Heap::String::StringType_Complex); if (subtype() == Heap::String::StringType_ArrayIndex) |