summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4compilerscanfunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp
index f985c74f9d..8824a47def 100644
--- a/src/qml/compiler/qv4compilerscanfunctions.cpp
+++ b/src/qml/compiler/qv4compilerscanfunctions.cpp
@@ -431,12 +431,14 @@ void ScanFunctions::enterFunction(Node *ast, const QString &name, FormalParamete
if (body && !_context->isStrict)
checkDirectivePrologue(body->elements);
+ bool isSimpleParameterList = formals->isSimpleParameterList();
+
for (FormalParameterList *it = formals; it; it = it->next) {
QString arg = it->name.toString();
int duplicateIndex = _context->arguments.indexOf(arg);
if (duplicateIndex != -1) {
- if (_context->isStrict) {
- _cg->throwSyntaxError(it->identifierToken, QStringLiteral("Duplicate parameter name '%1' is not allowed in strict mode").arg(arg));
+ if (_context->isStrict || !isSimpleParameterList) {
+ _cg->throwSyntaxError(it->identifierToken, QStringLiteral("Duplicate parameter name '%1' is not allowed.").arg(arg));
return;
} else {
// change the name of the earlier argument to enforce the specified lookup semantics