From: Jedrzej Nowacki Date: Thu, 4 Aug 2011 09:12:48 +0000 (+0200) Subject: Replace duplicated code by a function call. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=26f31e663f56ab60f620ccf50005e6c85b654242;p=konrad%2Fqtdeclarative.git 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 Reviewed-by: Simon Hausmann --- diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp index 6195345..3964134 100644 --- a/src/declarative/qml/v8/qv8engine.cpp +++ b/src/declarative/qml/v8/qv8engine.cpp @@ -491,16 +491,7 @@ QVariant QV8Engine::toBasicVariant(v8::Handle value) if (value->IsRegExp()) { v8::Context::Scope scope(context()); - v8::Handle jsRegExp = v8::Handle::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::Cast(value)); } else if (value->IsArray()) { v8::Context::Scope scope(context()); QVariantList rv;