diff options
Diffstat (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsfunctioninitializer.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp index 3001af1152..9fb83014fe 100644 --- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp +++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp @@ -59,6 +59,7 @@ void QQmlJSFunctionInitializer::populateSignature( error->type = QtWarningMsg; error->loc = ast->firstSourceLocation(); error->message = message; + function->isFullyTyped = false; }; if (!m_typeResolver->canCallJSFunctions()) { @@ -71,6 +72,11 @@ void QQmlJSFunctionInitializer::populateSignature( if (ast->formals) arguments = ast->formals->formals(); + // If the function has no arguments and no return type annotation we assume it's untyped. + // You can annotate it to return void to make it typed. + // Otherwise we first assume it's typed and reset the flag if we detect a problem. + function->isFullyTyped = !arguments.isEmpty() || ast->typeAnnotation; + if (function->argumentTypes.isEmpty()) { for (const QQmlJS::AST::BoundName &argument : std::as_const(arguments)) { if (argument.typeAnnotation) { |
