aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-03-15 22:33:11 +0100
committerLars Knoll <lars.knoll@qt.io>2018-04-26 20:27:05 +0000
commita1e5364b492610adf0636fefa3fc400558e211b6 (patch)
tree3c4fa3d591e1f5254b52dbe2f3e215417205e803 /src/qml/jsruntime/qv4functionobject.cpp
parent783088c3a49e3c344dbd4566cc6ed5dd30c27f31 (diff)
Fix length property of Function objects
According to ES6, the length property is the number of required arguments, ie. the number of arguments until the first arg that has adefault parameter. Also fix a crash when parsing a parameterlist with a trailing comma. Change-Id: I4f6b2be4feae7b513388be66b43b160bb3cc77f1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 1a26fc857c..327a15361f 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -422,7 +422,7 @@ void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function
ScopedString name(s, function->name());
f->init(name, true);
Q_ASSERT(internalClass && internalClass->find(s.engine->id_length()) == Index_Length);
- setProperty(s.engine, Index_Length, Primitive::fromInt32(f->formalParameterCount()));
+ setProperty(s.engine, Index_Length, Primitive::fromInt32(int(function->compiledFunction->length)));
}
Heap::InternalClass *ScriptFunction::classForConstructor() const