aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_engine.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-12-12 08:28:08 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-12-12 09:09:32 +0100
commit463ed070beb7cc5ad15692b6ea2cc403695b2a49 (patch)
tree728518daf2986fb9cdf7cf09b88e441913bf1794 /qmljs_engine.cpp
parent834d0b72dcb4f785699d2b9b476bc9a78f5574fb (diff)
Properly set the prototype for regexp objects
Clean up the code, so that regexp's get instantiated by the ExecutionEngine Change-Id: Iacc8d9fee0427342156747d6e8814d7660bdbb1a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qmljs_engine.cpp')
-rw-r--r--qmljs_engine.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qmljs_engine.cpp b/qmljs_engine.cpp
index a29088f68e..6e837e21ba 100644
--- a/qmljs_engine.cpp
+++ b/qmljs_engine.cpp
@@ -357,7 +357,7 @@ FunctionObject *ExecutionEngine::newDateCtor(ExecutionContext *ctx)
return new (memoryManager) DateCtor(ctx);
}
-Object *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
+RegExpObject *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
{
bool global = (flags & IR::RegExp::RegExp_Global);
QRegularExpression::PatternOptions options = 0;
@@ -366,7 +366,13 @@ Object *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
if (flags & IR::RegExp::RegExp_Multiline)
options |= QRegularExpression::MultilineOption;
- Object *object = new (memoryManager) RegExpObject(QRegularExpression(pattern, options), global);
+ QRegularExpression re(pattern, options);
+ return newRegExpObject(re, global);
+}
+
+RegExpObject *ExecutionEngine::newRegExpObject(const QRegularExpression &re, bool global)
+{
+ RegExpObject *object = new (memoryManager) RegExpObject(re, global);
object->prototype = regExpPrototype;
return object;
}