aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-07 22:27:23 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-10 14:16:12 +0000
commit886d463061ba34802bf844133396e3706d6912a4 (patch)
tree066b86b99f71388acb07ef1a4e8fc4bb4331ceb2 /src/qml/jsruntime/qv4engine.cpp
parent18d2f78437d28987297148b63b99ceed6313a78a (diff)
Enable unicode regular expressions
Add support for the 'u' flag for regular expressions. Change-Id: I409054eaa9c50183619752d14f2638f5a38c0ea7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 69b23484a8..6d5a43dd1f 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -377,6 +377,8 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine)
Q_ASSERT(index == RegExpObject::Index_IgnoreCase);
ic = ic->addMember((str = newIdentifier(QStringLiteral("multiline")))->propertyKey(), Attr_ReadOnly, &index);
Q_ASSERT(index == RegExpObject::Index_Multiline);
+ ic = ic->addMember((str = newIdentifier(QStringLiteral("unicode")))->propertyKey(), Attr_ReadOnly, &index);
+ Q_ASSERT(index == RegExpObject::Index_Unicode);
jsObjects[RegExpProto] = memoryManager->allocObject<RegExpPrototype>(ic->d());
classes[Class_RegExpObject] = ic->changePrototype(regExpPrototype()->d());
@@ -787,9 +789,10 @@ Heap::RegExpObject *ExecutionEngine::newRegExpObject(const QString &pattern, int
bool global = (flags & QV4::CompiledData::RegExp::RegExp_Global);
bool ignoreCase = (flags & QV4::CompiledData::RegExp::RegExp_IgnoreCase);
bool multiline = (flags & QV4::CompiledData::RegExp::RegExp_Multiline);
+ bool unicode = (flags & QV4::CompiledData::RegExp::RegExp_Unicode);
Scope scope(this);
- Scoped<RegExp> re(scope, RegExp::create(this, pattern, ignoreCase, multiline, global));
+ Scoped<RegExp> re(scope, RegExp::create(this, pattern, ignoreCase, multiline, global, unicode));
return newRegExpObject(re);
}