aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexpobject_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-08 13:15:40 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-08-15 14:24:23 +0000
commita1964f0b8e0569ef9ab754e2ec4c4d0559bc7681 (patch)
tree36416a7583527d87409ce0f9152687750a265e03 /src/qml/jsruntime/qv4regexpobject_p.h
parent15f56b74dc18c1105c9943f76599dbab5214b8e8 (diff)
Cleanup RegExpObject
Move properties from RegExpObject to getters in RegExp.prototype to be compliant with the JS spec. Implement support for the sticky flags ('y') and correctly parse the flags in the RegExp constructor. Change-Id: I5cf05d14e8139cf30d46235b8d466fb96084fcb7 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.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 74ea8aea4e..71936e2450 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -76,7 +76,7 @@ namespace Heap {
Member(class, Pointer, RegExp *, value)
DECLARE_HEAP_OBJECT(RegExpObject, Object) {
- DECLARE_MARKOBJECTS(RegExpObject);
+ DECLARE_MARKOBJECTS(RegExpObject)
void init();
void init(QV4::RegExp *value);
@@ -109,16 +109,12 @@ struct RegExpObject: Object {
RegExp_Global = 0x01,
RegExp_IgnoreCase = 0x02,
RegExp_Multiline = 0x04,
- RegExp_Unicode = 0x08
+ RegExp_Unicode = 0x08,
+ RegExp_Sticky = 0x10
};
enum {
Index_LastIndex = 0,
- Index_Source = 1,
- Index_Global = 2,
- Index_IgnoreCase = 3,
- Index_Multiline = 4,
- Index_Unicode = 5,
Index_ArrayIndex = Heap::ArrayObject::LengthPropertyIndex + 1,
Index_ArrayInput = Index_ArrayIndex + 1
};
@@ -126,7 +122,7 @@ struct RegExpObject: Object {
enum { NInlineProperties = 5 };
Heap::RegExp *value() const { return d()->value; }
- bool global() const { return d()->value->global; }
+ bool global() const { return d()->value->flags & CompiledData::RegExp::RegExp_Global; }
void initProperties();
@@ -165,13 +161,21 @@ struct RegExpPrototype: RegExpObject
void init(ExecutionEngine *engine, Object *ctor);
static ReturnedValue method_exec(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_get_flags(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_get_global(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_get_ignoreCase(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_match(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_get_multiline(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_get_source(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_get_sticky(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
static ReturnedValue method_test(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
- static ReturnedValue method_compile(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
-
- static ReturnedValue method_match(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_get_unicode(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ // Web extension
+ static ReturnedValue method_compile(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ // properties on the constructor, web extensions
template <uint index>
static ReturnedValue method_get_lastMatch_n(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
static ReturnedValue method_get_lastParen(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);