aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexpobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 4ef4fa2c9e..9df286065d 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -332,7 +332,13 @@ ReturnedValue RegExpCtor::virtualCallAsConstructor(const FunctionObject *fo, con
return scope.engine->throwSyntaxError(QStringLiteral("Invalid regular expression"));
}
- return Encode(scope.engine->newRegExpObject(regexp));
+ ReturnedValue o = Encode(scope.engine->newRegExpObject(regexp));
+
+ if (!newTarget)
+ return o;
+ ScopedObject obj(scope, o);
+ obj->setProtoFromNewTarget(newTarget);
+ return obj->asReturnedValue();
}
ReturnedValue RegExpCtor::virtualCall(const FunctionObject *f, const Value *, const Value *argv, int argc)