From a1e5364b492610adf0636fefa3fc400558e211b6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 15 Mar 2018 22:33:11 +0100 Subject: 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 --- src/qml/compiler/qv4compileddata.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/qml/compiler/qv4compileddata.cpp') diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 8f8514535a..59c37fb6c7 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -520,6 +520,7 @@ Unit *CompilationUnit::createUnitData(QmlIR::Document *irDocument) signalParameterNameTable.append(stringTable.getStringId(arg)); function->nFormals = formals.size(); + function->length = function->nFormals; // Hack to ensure an activation is created. function->flags |= QV4::CompiledData::Function::HasCatchOrWith | QV4::CompiledData::Function::HasDirectEval; -- cgit v1.2.3