diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-24 01:00:07 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-24 01:00:07 +0100 |
commit | df8784fa1fc4792007393ea995756c2d490691d7 (patch) | |
tree | d4b8d6bdc855e4045c39f7710f206b7cfcf3d493 /src/qml/jsruntime/qv4booleanobject.cpp | |
parent | b799e061a3cbf995ac7c88b315f5916e3a687162 (diff) | |
parent | 5246b910771e0dd824b4eea7c5245e5f9f3a63f0 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I57e4b762dcccf2f7f6e4b659f6fc8c40465d3322
Diffstat (limited to 'src/qml/jsruntime/qv4booleanobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4booleanobject.cpp | 12 |
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) |