aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4booleanobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4booleanobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4booleanobject.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp
index 075ee1657e..3e5f51c302 100644
--- a/src/qml/jsruntime/qv4booleanobject.cpp
+++ b/src/qml/jsruntime/qv4booleanobject.cpp
@@ -50,10 +50,18 @@ void Heap::BooleanCtor::init(QV4::ExecutionContext *scope)
Heap::FunctionObject::init(scope, QStringLiteral("Boolean"));
}
-ReturnedValue BooleanCtor::virtualCallAsConstructor(const FunctionObject *that, const Value *argv, int argc, const Value *)
+ReturnedValue BooleanCtor::virtualCallAsConstructor(const FunctionObject *that, const Value *argv, int argc, const Value *newTarget)
{
+ auto v4 = that->engine();
bool n = argc ? argv[0].toBoolean() : false;
- return Encode(that->engine()->newBooleanObject(n));
+
+ ReturnedValue o = Encode(v4->newBooleanObject(n));
+ if (!newTarget)
+ return o;
+ Scope scope(v4);
+ ScopedObject obj(scope, o);
+ obj->setProtoFromNewTarget(newTarget);
+ return obj->asReturnedValue();
}
ReturnedValue BooleanCtor::virtualCall(const FunctionObject *, const Value *, const Value *argv, int argc)