diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-01 10:35:47 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-04 18:25:19 +0000 |
commit | 656e50abb15e2df1fb47b158bd79dc3590220175 (patch) | |
tree | 59b83fa572902f365f3acbae00a64fa10a78bd4d /src | |
parent | a3225954d1049d9e4fea3171de00b24318a5ff31 (diff) |
Arrow and generator functions don't have a prototype property
Change-Id: Icbc25f1f723fe45a8c265f1b4bdf5f3fad3c4775
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4generatorobject_p.h | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 04fbe2d1e3..a2afeb87d7 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -521,7 +521,7 @@ void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function ScopedString name(s, n ? n->d() : function->name()); if (name) f->setName(name); - if (makeConstructor) + if (makeConstructor && !function->isArrowFunction()) f->createDefaultPrototypeProperty(Heap::FunctionObject::Index_ProtoConstructor); Q_ASSERT(internalClass && internalClass->find(s.engine->id_length()->propertyKey()) == Index_Length); diff --git a/src/qml/jsruntime/qv4generatorobject_p.h b/src/qml/jsruntime/qv4generatorobject_p.h index 55e6091ad5..c3b8e84154 100644 --- a/src/qml/jsruntime/qv4generatorobject_p.h +++ b/src/qml/jsruntime/qv4generatorobject_p.h @@ -73,6 +73,9 @@ struct GeneratorFunctionCtor : FunctionObject { }; struct GeneratorFunction : ScriptFunction { + void init(QV4::ExecutionContext *scope, Function *function, QV4::String *name = nullptr) { + ScriptFunction::init(scope, function, name, false); + } }; struct MemberGeneratorFunction : MemberFunction { |