aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorJedrzej Nowacki <jedrzej.nowacki@nokia.com>2011-08-04 11:12:48 +0200
committerQt by Nokia <qt-info@nokia.com>2011-08-10 12:49:21 +0200
commit26f31e663f56ab60f620ccf50005e6c85b654242 (patch)
tree90d82a273d145877579fe714894252fabc4756f4 /src/declarative/qml
parent939f74ca4a5ff1df30c7fcd167fd6fb15945c6ab (diff)
Replace duplicated code by a function call.
According to comment the code was copied from QtScript. As the implementation is merged to QtDeclarative we can use common code path. Change-Id: Id603ef0207a1356f8c010a35fe601568a03aac48 Reviewed-on: http://codereview.qt.nokia.com/2699 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/v8/qv8engine.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp
index 6195345aae..3964134201 100644
--- a/src/declarative/qml/v8/qv8engine.cpp
+++ b/src/declarative/qml/v8/qv8engine.cpp
@@ -491,16 +491,7 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value)
if (value->IsRegExp()) {
v8::Context::Scope scope(context());
- v8::Handle<v8::RegExp> jsRegExp = v8::Handle<v8::RegExp>::Cast(value);
- // Copied from QtScript
- // Converts a JS RegExp to a QRegExp.
- // The conversion is not 100% exact since ECMA regexp and QRegExp
- // have different semantics/flags, but we try to do our best.
- QString pattern = toString(jsRegExp->GetSource());
- Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive;
- if (jsRegExp->GetFlags() & v8::RegExp::kIgnoreCase)
- caseSensitivity = Qt::CaseInsensitive;
- return QRegExp(pattern, caseSensitivity, QRegExp::RegExp2);
+ return QJSConverter::toRegExp(v8::Handle<v8::RegExp>::Cast(value));
} else if (value->IsArray()) {
v8::Context::Scope scope(context());
QVariantList rv;