aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-01 10:35:47 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-04 18:25:19 +0000
commit656e50abb15e2df1fb47b158bd79dc3590220175 (patch)
tree59b83fa572902f365f3acbae00a64fa10a78bd4d
parenta3225954d1049d9e4fea3171de00b24318a5ff31 (diff)
Arrow and generator functions don't have a prototype property
Change-Id: Icbc25f1f723fe45a8c265f1b4bdf5f3fad3c4775 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4generatorobject_p.h3
-rw-r--r--tests/auto/qml/ecmascripttests/TestExpectations1
3 files changed, 4 insertions, 2 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 {
diff --git a/tests/auto/qml/ecmascripttests/TestExpectations b/tests/auto/qml/ecmascripttests/TestExpectations
index ea3cf60c7a..9a61cb36a3 100644
--- a/tests/auto/qml/ecmascripttests/TestExpectations
+++ b/tests/auto/qml/ecmascripttests/TestExpectations
@@ -655,7 +655,6 @@ language/expressions/arrow-function/lexical-new.target.js fails
language/expressions/arrow-function/lexical-super-call-from-within-constructor.js fails
language/expressions/arrow-function/lexical-supercall-from-immediately-invoked-arrow.js fails
language/expressions/arrow-function/lexical-this.js fails
-language/expressions/arrow-function/prototype-rules.js fails
language/expressions/arrow-function/scope-body-lex-distinct.js sloppyFails
language/expressions/arrow-function/scope-param-elem-var-close.js sloppyFails
language/expressions/arrow-function/scope-param-elem-var-open.js sloppyFails