aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-01 10:33:09 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-04 18:25:15 +0000
commita3225954d1049d9e4fea3171de00b24318a5ff31 (patch)
tree78c9db59611f19df439ac61fb2db339eee5da741 /src/qml/jsruntime/qv4functionobject.cpp
parent656db7a425fec6661ee3b42b89594a3e28637cdd (diff)
Member functions should not have a prototype property
Change-Id: I19eb4012c8fee51a7e5bf264d11ab5337ac2a88d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index f4037991b1..04fbe2d1e3 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -507,7 +507,7 @@ ReturnedValue ScriptFunction::virtualCall(const FunctionObject *fo, const Value
return result;
}
-void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function, QV4::String *n)
+void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function, QV4::String *n, bool makeConstructor)
{
FunctionObject::init();
this->scope.set(scope->engine(), scope->d());
@@ -521,7 +521,8 @@ void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function
ScopedString name(s, n ? n->d() : function->name());
if (name)
f->setName(name);
- f->createDefaultPrototypeProperty(Heap::FunctionObject::Index_ProtoConstructor);
+ if (makeConstructor)
+ f->createDefaultPrototypeProperty(Heap::FunctionObject::Index_ProtoConstructor);
Q_ASSERT(internalClass && internalClass->find(s.engine->id_length()->propertyKey()) == Index_Length);
setProperty(s.engine, Index_Length, Primitive::fromInt32(int(function->compiledFunction->length)));