diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-08-08 21:33:18 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-15 14:24:41 +0000 |
commit | b862d429b1010fecf2e29d0e781b012a4b07cad6 (patch) | |
tree | d0040a21dd8d55cbf42f9724e67f2deb3e470b41 /src/qml/jsruntime/qv4regexpobject_p.h | |
parent | 4bfd94c35e5099557cafcc9ae9b7d7a970089c9f (diff) |
Fix some details in RegExp handling
Change-Id: If9f7c07ea657ba8503b9188a7b77e301f23423ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject_p.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h index 2173981b66..ba5a106c6b 100644 --- a/src/qml/jsruntime/qv4regexpobject_p.h +++ b/src/qml/jsruntime/qv4regexpobject_p.h @@ -122,7 +122,8 @@ struct RegExpObject: Object { enum { NInlineProperties = 5 }; Heap::RegExp *value() const { return d()->value; } - bool global() const { return d()->value->flags & CompiledData::RegExp::RegExp_Global; } + bool global() const { return d()->value->global(); } + bool sticky() const { return d()->value->sticky(); } void initProperties(); @@ -132,6 +133,10 @@ struct RegExpObject: Object { } void setLastIndex(int index) { Q_ASSERT(Index_LastIndex == internalClass()->find(engine()->id_lastIndex()->propertyKey())); + if (!internalClass()->propertyData[Index_LastIndex].isWritable()) { + engine()->throwTypeError(); + return; + } return setProperty(Index_LastIndex, Primitive::fromInt32(index)); } @@ -156,7 +161,7 @@ struct RegExpCtor: FunctionObject static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; -struct RegExpPrototype: RegExpObject +struct RegExpPrototype: Object { void init(ExecutionEngine *engine, Object *ctor); |