diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 2 | ||||
| -rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 2 | ||||
| -rw-r--r-- | src/qml/compiler/qv4compilercontext_p.h | 2 | ||||
| -rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 10 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 9de27a2588..f763e55113 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -983,7 +983,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiSourceElement *node) f->index = index; f->nameIndex = registerString(funDecl->name.toString()); - const QStringList formals = funDecl->formals->formals(); + const QStringList formals = funDecl->formals ? funDecl->formals->formals() : QStringList(); int formalsCount = formals.size(); f->formals.allocate(pool, formalsCount); diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 0a46fc7a8e..4e6d56adcf 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -2425,7 +2425,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, } } if (_context->usesArgumentsObject == Context::ArgumentsObjectUsed) { - if (_context->isStrict || !formals->isSimpleParameterList()) { + if (_context->isStrict || (formals && !formals->isSimpleParameterList())) { Instruction::CreateUnmappedArgumentsObject setup; bytecodeGenerator->addInstruction(setup); } else { diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index e53fb26e4a..2479465587 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -265,7 +265,7 @@ struct Context { return true; if (type != FunctionDefinition) { - if (formals->containsName(name)) + if (formals && formals->containsName(name)) return (scope == QQmlJS::AST::VariableScope::Var); } MemberMap::iterator it = members.find(name); diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index c6e792fc45..3bbef3a96a 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -420,7 +420,7 @@ bool ScanFunctions::enterFunction(Node *ast, const QString &name, FormalParamete outerContext->usesArgumentsObject = Context::ArgumentsObjectNotUsed; } - if (formals->containsName(QStringLiteral("arguments"))) + if (formals && formals->containsName(QStringLiteral("arguments"))) _context->usesArgumentsObject = Context::ArgumentsObjectNotUsed; if (expr) { if (expr->isArrowFunction) @@ -430,18 +430,18 @@ bool ScanFunctions::enterFunction(Node *ast, const QString &name, FormalParamete } - if (!name.isEmpty() && !formals->containsName(name)) + if (!name.isEmpty() && (!formals || !formals->containsName(name))) _context->addLocalVar(name, Context::ThisFunctionName, VariableScope::Var); _context->formals = formals; if (body && !_context->isStrict) checkDirectivePrologue(body); - bool isSimpleParameterList = formals->isSimpleParameterList(); + bool isSimpleParameterList = formals && formals->isSimpleParameterList(); - _context->arguments = formals->formals(); + _context->arguments = formals ? formals->formals() : QStringList(); - const QStringList boundNames = formals->boundNames(); + const QStringList boundNames = formals ? formals->boundNames() : QStringList(); for (int i = 0; i < boundNames.size(); ++i) { const QString &arg = boundNames.at(i); if (_context->isStrict || !isSimpleParameterList) { |
