8#include <QtCore/qfileinfo.h>
9#include <QtCore/qdir.h>
10#include <QtCore/qqueue.h>
11#include <QtCore/qscopedvaluerollback.h>
12#include <QtCore/qpoint.h>
13#include <QtCore/qrect.h>
14#include <QtCore/qsize.h>
16#include <QtQml/private/qv4codegen_p.h>
17#include <QtQml/private/qqmlstringconverters_p.h>
18#include <QtQml/private/qqmlirbuilder_p.h>
63template<
typename Node>
78 : m_implicitImportDirectory(implicitImportDirectory),
79 m_qmldirFiles(qmldirFiles),
81 m_exportedRootScope(
target),
91 m_globalScope = m_currentScope;
92 m_currentScope->setIsComposite(
true);
94 m_currentScope->setInternalName(u
"global"_s);
117 for (
const auto &jsGlobVar : jsGlobVars)
118 m_currentScope->insertJSIdentifier(jsGlobVar, globalJavaScript);
123void QQmlJSImportVisitor::populateCurrentScope(
160 return s->internalName() ==
name;
165 auto it = std::find_if(scopes.begin(), scopes.end(), pred);
166 if (
it == scopes.
end()) {
197void QQmlJSImportVisitor::resolveAliasesAndIds()
202 qsizetype lastRequeueLength = std::numeric_limits<qsizetype>::max();
207 const auto properties =
object->ownProperties();
209 bool doRequeue =
false;
217 bool foundProperty =
false;
222 if (!
type.isNull()) {
223 foundProperty =
true;
234 foundProperty =
false;
272 if (!typeScope.
isNull()) {
273 object->setPropertyLocallyRequired(
282 object->addOwnProperty(newProperty);
286 const auto childScopes =
object->childScopes();
287 for (
const auto &childScope : childScopes) {
304 if (objects.
isEmpty() && requeue.
size() < lastRequeueLength) {
305 lastRequeueLength = requeue.
size();
306 objects.
swap(requeue);
312 const auto properties =
object->ownProperties();
327 const auto resource =
mapper->entry(
329 if (resource.isValid()) {
330 return resource.resourcePath.contains(u
'/')
331 ? (u
':' + resource.resourcePath.left(
332 resource.resourcePath.lastIndexOf(u
'/') + 1))
340void QQmlJSImportVisitor::processImportWarnings(
344 if (warnings.isEmpty())
352void QQmlJSImportVisitor::importBaseModules()
360 addImportWithLocation(*
it, invalidLoc);
416 resolveAliasesAndIds();
431 unusedImports.
remove(importLocation);
434 if (unusedImports.isEmpty())
439 unusedImports.remove(
import);
441 for (
const auto &
import : unusedImports) {
456 case Node::Kind_StringLiteral:
457 return cast<StringLiteral *>(expr->
expression)->value.toString();
458 case Node::Kind_NumericLiteral:
459 return cast<NumericLiteral *>(expr->
expression)->value;
477 switch (memberItem->member->kind) {
478 case Node::Kind_UiScriptBinding: {
479 auto *scriptBinding = QQmlJS::AST::cast<UiScriptBinding*>(memberItem->member);
490 annotationList.
append(qqmljsAnnotation);
493 return annotationList;
501 if (!
type->isFullyResolved()) {
502 if (!
type->isInCustomParserParent()) {
509 auto binding =
it->create();
510 if (binding.isValid())
511 type->addOwnPropertyBinding(binding,
it->specifier);
536 parentScope = parentScope->
baseType();
538 const QString defaultPropertyName =
541 if (defaultPropertyName.
isEmpty()) {
544 bool isComponent =
false;
561 auto propType = defaultProp.
type();
565 "missing an import.")
566 .arg(defaultPropertyName)
571 if (propType.isNull()) {
572 handleUnresolvedDefaultProperty(propType);
578 && !propType->isListProperty()) {
580 QStringLiteral(
"Cannot assign multiple objects to a default non-list property"),
587 const auto scopes = *
it;
588 for (
const auto &scope : scopes) {
594 if (propType->canAssign(scope)) {
595 scope->setIsWrappedInImplicitComponent(
611 auto property =
type.scope->ownProperty(
type.name);
613 if (
const auto propertyType =
615 property.setType(propertyType);
619 +
QStringLiteral(
" was not found. Did you add all import paths?"),
639 const auto uniqueBindingId =
qMakePair(objectBinding.scope, objectBinding.name);
640 if (visited.
contains(uniqueBindingId))
642 visited.
insert(uniqueBindingId);
644 auto [existingBindingsBegin, existingBindingsEnd] =
645 uniqueBindingId.first->ownPropertyBindings(uniqueBindingId.second);
646 const bool hasLiteralBindings =
647 std::any_of(existingBindingsBegin, existingBindingsEnd,
649 if (hasLiteralBindings)
650 foundLiterals.
insert(uniqueBindingId);
660 const QString propertyName = objectBinding.name;
676 "missing an import.")
682 handleUnresolvedProperty(
property.type());
692 if (!objectBinding.onToken && !
property.type()->canAssign(childScope)) {
695 "incompatible type \"%3\"")
703 objectBinding.childScope->setIsWrappedInImplicitComponent(
707 const auto uniqueBindingId =
qMakePair(objectBinding.scope, objectBinding.name);
710 if (objectBinding.onToken) {
712 if (foundInterceptors.
contains(uniqueBindingId)) {
717 foundInterceptors.
insert(uniqueBindingId);
720 if (foundValueSources.
contains(uniqueBindingId)) {
724 }
else if (foundObjects.
contains(uniqueBindingId)
725 || foundLiterals.
contains(uniqueBindingId)) {
731 foundValueSources.
insert(uniqueBindingId);
741 if (foundValueSources.
contains(uniqueBindingId)) {
743 QStringLiteral(
"Cannot combine value source and binding on property \"%1\"")
747 foundObjects.
insert(uniqueBindingId);
756 if (!required.scope->hasProperty(required.name)) {
758 QStringLiteral(
"Property \"%1\" was marked as required but does not exist.")
770 scopesToSearch << scope;
771 const auto ownProperties = scope->ownProperties();
772 for (
auto propertyIt = ownProperties.constBegin();
773 propertyIt != ownProperties.constEnd(); ++propertyIt) {
774 const QString propName = propertyIt.key();
778 if (requiredScope->isPropertyLocallyRequired(propName)) {
782 return scope->hasPropertyBindings(propName);
788 bool propertyUsedInRootAlias =
false;
796 property.aliasExpression().split(u
'.');
798 if (aliasExpression.size() != 2)
800 if (aliasExpression[0] == scopeId
801 && aliasExpression[1] == propName) {
802 propertyUsedInRootAlias =
true;
808 if (propertyUsedInRootAlias)
812 ? scopesToSearch.
at(scopesToSearch.
size() - 2)
819 const QString requiredScopeName = prevRequiredScope
823 std::optional<QQmlJSFixSuggestion> suggestion;
827 "Component is missing required property %1 from %2")
829 .arg(propertyScopeName);
830 if (requiredScope != scope) {
831 if (!prevRequiredScope.
isNull()) {
832 auto sourceScope = prevRequiredScope->
baseType();
834 "%1:%2:%3: Property marked as required in %4"_L1
835 .arg(sourceScope->filePath())
836 .arg(sourceScope->sourceLocation().startLine)
837 .arg(sourceScope->sourceLocation().startColumn)
838 .arg(requiredScopeName),
839 sourceScope->sourceLocation()
844 .arg(requiredScopeName);
852 prevRequiredScope = requiredScope;
872 std::optional<QQmlJSFixSuggestion> fixSuggestion;
875 baseScope = baseScope->baseType()) {
878 suggestion.has_value()) {
879 fixSuggestion = suggestion;
885 "exists in the current element.")
894 "to a missing import statement or incomplete "
900 const auto &annotations =
property.annotations();
902 const auto deprecationAnn =
903 std::find_if(annotations.cbegin(), annotations.cend(),
906 if (deprecationAnn != annotations.cend()) {
907 const auto deprecation = deprecationAnn->deprecation();
912 if (!deprecation.reason.isEmpty())
921void QQmlJSImportVisitor::checkSignal(
927 std::optional<QQmlJSMetaMethod> signalMethod;
936 setSignalMethod(signalScope, *
signal);
943 if (
auto notify =
p->notify(); !notify.isEmpty()) {
944 setSignalMethod(signalScope, notify);
952 if (!signalMethod.has_value()) {
953 std::optional<QQmlJSFixSuggestion> fix;
966 "Implicitly defining %1 as signal handler in Connections is deprecated. "
967 "Create a function instead"_L1.arg(handlerName),
970 "function %1(%2) { ... }"_L1.arg(handlerName, handlerParameters.join(u
", "))
980 const auto signalParameters = signalMethod->parameters();
983 for (
int i = 0,
end = signalParameters.size();
i <
end;
i++) {
984 auto &
p = signalParameters[
i];
985 parameterNameIndexes[
p.name()] =
i;
987 auto signalName = [&]() {
989 return u
" called %1"_s.arg(*
signal);
992 auto type =
p.type();
996 "Type %1 of parameter %2 in signal%3 was not found, but is "
997 "required to compile %4. Did you add all import paths?")
998 .
arg(
p.typeName(),
p.name(), signalName(), handlerName),
1003 if (
type->isComposite())
1011 auto parameterName = [&]() {
1012 if (
p.name().isEmpty())
1014 return u
" called %1"_s.
arg(
p.name());
1016 switch (
type->accessSemantics()) {
1017 case QQmlJSScope::AccessSemantics::Reference:
1020 "passed by pointer to be able to compile %4. ")
1021 .arg(
p.typeName(), parameterName(), signalName(),
1025 case QQmlJSScope::AccessSemantics::Value:
1026 case QQmlJSScope::AccessSemantics::Sequence:
1030 "Type %1 of parameter%2 in signal%3 should be passed by "
1031 "value or const reference to be able to compile %4. ")
1032 .arg(
p.typeName(), parameterName(), signalName(),
1036 case QQmlJSScope::AccessSemantics::None:
1038 QStringLiteral(
"Type %1 of parameter%2 in signal%3 required by the "
1039 "compilation of %4 cannot be used. ")
1040 .arg(
p.typeName(), parameterName(), signalName(), handlerName),
1046 if (handlerParameters.size() > signalParameters.size()) {
1048 " parameters than the signal it handles.")
1055 const QStringView handlerParameter = handlerParameters.at(
i);
1065 " is called \"%3\". The signal has a parameter"
1066 " of the same name in position %4.")
1068 .arg(handlerName, handlerParameter)
1097 parentScope = parentScope->
baseType();
1099 const QString defaultPropertyName =
1102 if (defaultPropertyName.
isEmpty())
1120 for (
const auto &seen : std::as_const(scopes)) {
1121 inheritenceCycle.
append(seen->baseTypeName());
1124 inheritenceCycle.
append(scopes.
first()->baseTypeName());
1136 const auto newScope = scope->
baseType();
1137 if (newScope.isNull()) {
1140 if (!
error.isEmpty()) {
1142 }
else if (!
name.isEmpty()) {
1160 if (annotation.isDeprecation()) {
1183 while (!children.isEmpty()) {
1184 auto childScope = children.takeFirst();
1185 const auto type = childScope->scopeType();
1189 if (!childScope->baseType()) {
1194 childScope->internalName()),
1197 children.append(childScope->childScopes());
1252 auto nameToVerify =
name.isEmpty() ? u
"<anon>"_s :
name;
1281 if (!suitableScope(scope))
1289 const auto &functionsAndExpressions = *
it;
1290 for (
const QString &functionOrExpression : functionsAndExpressions) {
1347 ||
s.contains(
QChar(0x2029u))) {
1350 bool escaped =
false;
1351 const QChar stringQuote =
s[0];
1357 }
else if (escaped) {
1359 if (
c == stringQuote)
1360 templateString.
chop(1);
1365 templateString += u
'\\';
1366 if (
c == u
'$' &&
i + 1 <
s.size() - 1 &&
s[
i + 1] == u
'{')
1367 templateString += u
'\\';
1370 templateString +=
c;
1374 "Use a template literal instead"_L1,
1376 u
"`" % templateString % u
"`"
1410 if (isRoot &&
base->internalName() == u
"QQmlComponent") {
1415 m_logger->
log(u
"Singleton Type %1 is not creatable."_s.arg(
1420 }
else if (!
base->isCreatable()) {
1478 m_logger->
log(u
"Inline component declaration must be followed by a typename"_s,
1486 switch (publicMember->
type) {
1495 method.setMethodType(QQmlJSMetaMethodType::Signal);
1500 param->name.toString(),
1516 const bool isAlias = (
typeName == u
"alias"_s);
1518 auto tryParseAlias = [&]() {
1525 const auto expression = cast<ExpressionStatement *>(publicMember->
statement);
1526 auto node = expression ? expression->expression :
nullptr;
1527 auto fex = cast<FieldMemberExpression *>(node);
1530 aliasExpr.
prepend(u
'.' + fex->name.toString());
1531 fex = cast<FieldMemberExpression *>(node);
1534 if (
const auto idExpression = cast<IdentifierExpression *>(node)) {
1535 aliasExpr.
prepend(idExpression->name.toString());
1540 "member expressions can be aliased."),
1563 }
else if (!isAlias) {
1624 if (!
name.isEmpty()) {
1626 method.setMethodType(QQmlJSMetaMethodType::Method);
1636 bool formalsFullyTyped = parseTypes;
1637 bool anyFormalTyped =
false;
1638 if (
const auto *formals = parseTypes ? fexpr->
formals :
nullptr) {
1639 const auto parameters = formals->formals();
1640 for (
const auto ¶meter : parameters) {
1642 ? parameter.typeAnnotation->type->toString()
1644 if (
type.isEmpty()) {
1645 formalsFullyTyped =
false;
1648 anyFormalTyped =
true;
1655 method.setIsJavaScriptFunction(!formalsFullyTyped);
1663 else if (anyFormalTyped)
1675 method.returnTypeName(),
false });
1687 visitFunctionExpressionHelper(fexpr);
1705 visitFunctionExpressionHelper(fdecl);
1760 registerMainString, registerCommentString, registerContextString, finalizeBinding);
1767 if (statement ==
nullptr)
1770 const auto *exprStatement = cast<const ExpressionStatement *>(statement);
1772 if (exprStatement ==
nullptr) {
1775 if (
const auto *block = cast<const Block *>(statement); block && block->statements) {
1776 location = block->statements->firstSourceLocation();
1786 auto expr = exprStatement->expression;
1788 combine(expr->firstSourceLocation(), expr->lastSourceLocation()),
1791 bool isUndefinedBinding =
false;
1793 switch (expr->kind) {
1794 case Node::Kind_TrueLiteral:
1797 case Node::Kind_FalseLiteral:
1800 case Node::Kind_NullExpression:
1803 case Node::Kind_IdentifierExpression: {
1804 auto idExpr = QQmlJS::AST::cast<QQmlJS::AST::IdentifierExpression *>(expr);
1806 isUndefinedBinding = (idExpr->name == u
"undefined");
1809 case Node::Kind_NumericLiteral:
1812 case Node::Kind_StringLiteral:
1815 case Node::Kind_RegExpLiteral:
1818 case Node::Kind_TemplateLiteral: {
1819 auto templateLit = QQmlJS::AST::cast<QQmlJS::AST::TemplateLiteral *>(expr);
1821 if (templateLit->hasNoSubstitution) {
1828 expression->accept(
this);
1858 if (!QQmlJSMetaPropertyBinding::isLiteralBinding(binding.
bindingType()))
1874 const auto *statement = cast<ExpressionStatement *>(scriptBinding->
statement);
1881 if (
const auto *idExpression = cast<IdentifierExpression *>(statement->expression))
1882 return idExpression->name.toString();
1883 else if (
const auto *idString = cast<StringLiteral *>(statement->expression)) {
1885 idString->firstSourceLocation());
1886 return idString->value.toString();
1889 statement->expression->firstSourceLocation());
1898 auto otherLocation = otherScopeWithID->sourceLocation();
1901 m_logger->
log(u
"Found a duplicated id. id %1 was first declared at %2:%3"_s.arg(
1908 if (!
name.isEmpty())
1931 const bool alreadyHasBinding = std::any_of(propertyBindings.first, propertyBindings.second,
1933 return binding.bindingType() == bindingType;
1935 if (alreadyHasBinding)
1955 handleIdDeclaration(scriptBinding);
1968 prefix =
name + u
'.';
1973 if (isAttachedProperty) {
1976 group->firstSourceLocation());
1980 group->firstSourceLocation());
1983 group->firstSourceLocation()));
2001 const auto statement = scriptBinding->
statement;
2007 signalParameters << formal->element->bindingIdentifier.toString();
2016 const auto firstSourceLocation = statement->firstSourceLocation();
2017 bool hasMultilineStatementBody =
2018 statement->lastSourceLocation().startLine > firstSourceLocation.startLine;
2032 firstSourceLocation,
2033 groupLocation =
group->firstSourceLocation(),
2034 signalParameters]() {
2038 const auto methods = scope->
methods(signalName, QQmlJSMetaMethodType::Signal);
2041 checkSignal(scope, groupLocation,
name, signalParameters);
2044 checkSignal(scope, groupLocation,
name, signalParameters);
2052 checkSignal(scope, groupLocation,
name, signalParameters);
2117 for (
auto element = arrayBinding->
members; element; element = element->next, ++
i) {
2118 const auto &
type = children[
i];
2120 m_logger->
log(u
"Declaring an object which is not an Qml object"
2121 " as a list member."_s,
qmlSyntax, element->firstSourceLocation());
2126 element->firstSourceLocation(),
false };
2142 for (
const auto *member = uied->
members; member; member = member->next) {
2143 qmlEnum.
addKey(member->member.toString());
2144 qmlEnum.
addValue(
int(member->value));
2150void QQmlJSImportVisitor::addImportWithLocation(
const QString &
name,
2168 if (fileInfo.isFile()) {
2172 addImportWithLocation(actualPrefix,
location);
2173 }
else if (fileInfo.isDir()) {
2176 for (
auto it = scopes.types().keyBegin(),
end = scopes.types().keyEnd();
it !=
end;
it++)
2192 addImportWithLocation(actualPrefix,
location);
2196 for (
auto it = scopes.types().keyBegin(),
end = scopes.types().keyEnd();
it !=
end;
it++)
2206 if (import->asToken.isValid()) {
2207 prefix +=
import->importId;
2210 auto filename =
import->fileName.toString();
2211 if (!filename.isEmpty()) {
2215 if (scheme ==
""_L1) {
2221 importFromQrc(absolute, prefix, importLocation);
2223 importFromHost(absolute, prefix, importLocation);
2225 processImportWarnings(
"path \"%1\""_L1.arg(
url.
path()), importLocation);
2227 }
else if (scheme ==
"file"_L1) {
2228 importFromHost(
url.
path(), prefix, importLocation);
2229 processImportWarnings(
"URL \"%1\""_L1.arg(
url.
path()), importLocation);
2231 }
else if (scheme ==
"qrc"_L1) {
2232 importFromQrc(
":"_L1 +
url.
path(), prefix, importLocation);
2233 processImportWarnings(
"URL \"%1\""_L1.arg(
url.
path()), importLocation);
2236 m_logger->
log(
"Unknown import syntax. Imports can be paths, qrc urls or file urls"_L1,
2237 qmlImport, import->firstSourceLocation());
2247 &staticModulesProvided);
2249 for (
auto it = imported.types().keyBegin(),
end = imported.types().keyEnd();
it !=
end;
it++)
2250 addImportWithLocation(*
it, import->firstSourceLocation());
2253 for (
const QString &staticModule : staticModulesProvided) {
2266#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
2277 assign(pragma->value);
2283 if (pragma->
name == u
"Strict"_s) {
2293 }
else if (pragma->
name == u
"Singleton") {
2295 }
else if (pragma->
name == u
"ComponentBehavior") {
2297 if (
value == u
"Bound") {
2299 }
else if (
value == u
"Unbound") {
2303 u
"Unkonwn argument \"%s\" to pragma ComponentBehavior"_s.arg(
value),
2307 }
else if (pragma->
name == u
"FunctionSignatureBehavior") {
2309 if (
value == u
"Enforced") {
2311 }
else if (
value == u
"Ignored") {
2315 u
"Unkonwn argument \"%s\" to pragma FunctionSignatureBehavior"_s.arg(
value),
2319 }
else if (pragma->
name == u
"ValueTypeBehavior") {
2321 if (
value == u
"Copy") {
2323 }
else if (
value == u
"Reference") {
2325 }
else if (
value == u
"Addressable") {
2327 }
else if (
value == u
"Inaddressable") {
2331 u
"Unkonwn argument \"%s\" to pragma ValueTypeBehavior"_s.arg(
value),
2416 { QQmlJSScope::JavaScriptIdentifier::LexicalScoped,
2417 catchStatement->patternElement->firstSourceLocation(), std::nullopt,
2418 catchStatement->patternElement->scope == QQmlJS::AST::VariableScope::Const });
2433 "and might cause false positives when analysing unqualified "
2455 { (vdl->declaration->scope == QQmlJS::AST::VariableScope::Var)
2456 ? QQmlJSScope::JavaScriptIdentifier::FunctionScoped
2457 : QQmlJSScope::JavaScriptIdentifier::LexicalScoped,
2458 vdl->declaration->firstSourceLocation(), typeName,
2459 vdl->declaration->scope == QQmlJS::AST::VariableScope::Const });
2467 for (
auto const &boundName : fpl->
boundNames()) {
2470 if (
TypeAnnotation *annotation = boundName.typeAnnotation.data())
2475 boundName.location,
typeName,
false });
2486 bool needsResolution =
false;
2487 int scopesEnteredCounter = 0;
2497 prefix = idName + u
'.';
2508 group->firstSourceLocation()));
2510 ++scopesEnteredCounter;
2511 needsResolution = needsResolution || !exists;
2516 for (
int i=0;
i < scopesEnteredCounter; ++
i) {
2521 if (needsResolution)
2541 int scopesEnteredCounter = 0;
2551 prefix = idName + u
'.';
2558 [[maybe_unused]]
bool exists =
2561 scopesEnteredCounter++;
2572 bool foundIds =
false;
2575 while (!childScopes.isEmpty()) {
2587 u
"Cannot defer property assignment to \"%1\". Assigning an id to an object or one of its sub-objects bound to a deferred property will make the assignment immediate."_s
2603 if (childScope->
hasInterface(u
"QQmlPropertyValueInterceptor"_s)) {
2617 for (
int i = 0;
i < scopesEnteredCounter; ++
i)
2643 importBaseModules();
2660 importBaseModules();
2676 if (
type.scope.isNull()) {
2679 }
else if (!
type.scope->ownAttachedTypeName().isEmpty()) {
static JNINativeMethod methods[]
constexpr bool isUpper() const noexcept
Returns true if the character is an uppercase letter, for example category() is Letter_Uppercase.
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
\inmodule QtCore \reentrant
QString baseName() const
Returns the base name of the file without the path.
QString absoluteFilePath() const
Returns an absolute path including the file name.
QString canonicalPath() const
Returns the file's path canonical path (excluding the file name), i.e.
bool isRelative() const
Returns true if the file path is relative, otherwise returns false (i.e.
bool remove(const Key &key)
Removes the item that has the key from the hash.
qsizetype size() const noexcept
Returns the number of items in the hash.
const_iterator constFind(const Key &key) const noexcept
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
const_iterator constBegin() const noexcept
void append(parameter_type t)
const_iterator constEnd() const noexcept
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
bool contains(const Key &key) const noexcept
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
void setFilename(const QString &filename)
void setAutoApplicable(bool autoApply=true)
QStack< FunctionOrExpressionIdentifier > m_functionStack
void checkGroupedAndAttachedScopes(QQmlJSScope::ConstPtr scope)
void processPropertyBindings()
void addDefaultProperties()
QHash< QQmlJSScope::ConstPtr, QList< QString > > m_functionsAndExpressions
bool m_thisScriptBindingIsJavaScript
QMultiHash< QString, QQmlJS::SourceLocation > m_importTypeLocationMap
QQmlJSScope::Ptr m_currentScope
void checkRequiredProperties()
QMultiHash< QString, QQmlJS::SourceLocation > m_importStaticModuleLocationMap
QSet< QString > m_usedTypes
QQmlJS::SourceLocation m_pendingSignalHandler
QQmlJSImporter * m_importer
QString m_implicitImportDirectory
QQmlJSScope::ConstPtr m_globalScope
void breakInheritanceCycles(const QQmlJSScope::Ptr &scope)
QList< QQmlJSScope::ConstPtr > m_qmlTypes
void checkDeprecation(const QQmlJSScope::ConstPtr &scope)
QStringList m_qmldirFiles
QQmlJSScope::Ptr m_savedBindingOuterScope
static QString implicitImportDirectory(const QString &localFile, QQmlJSResourceFileMapper *mapper)
void populateRuntimeFunctionIndicesForDocument() const
QHash< QQmlJS::SourceLocation, QQmlJSMetaSignalHandler > m_signalHandlers
QHash< QV4::CompiledData::Location, QQmlJSScope::ConstPtr > m_scopesByIrLocation
QList< UnfinishedBinding > m_bindings
QHash< QQmlJSScope::Ptr, QVector< QQmlJSScope::Ptr > > m_pendingDefaultProperties
QVector< QQmlJSScope::Ptr > m_objectDefinitionScopes
QVector< QQmlJSAnnotation > m_pendingMethodAnnotations
bool m_nextIsInlineComponent
QQmlJSScope::RootDocumentNameType RootDocumentNameType
void endVisit(QQmlJS::AST::ExpressionStatement *ast) override
bool enterEnvironmentNonUnique(QQmlJSScope::ScopeType type, const QString &name, const QQmlJS::SourceLocation &location)
void throwRecursionDepthError() override
void forgetFunctionExpression(const QString &name)
QHash< FunctionOrExpressionIdentifier, int > m_innerFunctions
QQmlJSMetaMethod::RelativeFunctionIndex addFunctionOrExpression(const QQmlJSScope::ConstPtr &scope, const QString &name)
void processDefaultProperties()
bool isImportPrefix(QString prefix) const
QVector< QQmlJSAnnotation > parseAnnotations(QQmlJS::AST::UiAnnotationList *list)
QVector< PendingPropertyObjectBinding > m_pendingPropertyObjectBindings
BindingExpressionParseResult
void flushPendingSignalParameters()
void processPropertyTypes()
QSet< QQmlJS::SourceLocation > m_importLocations
QVector< RequiredProperty > m_requiredProperties
QVector< PendingPropertyType > m_pendingPropertyTypes
int synthesizeCompilationUnitRuntimeFunctionIndices(const QQmlJSScope::Ptr &scope, int count) const
QVector< QQmlJSScope::Ptr > m_objectBindingScopes
QSet< QQmlJSScope::ConstPtr > m_literalScopesToCheck
bool rootScopeIsValid() const
bool isTypeResolved(const QQmlJSScope::ConstPtr &type, ErrorHandler handle)
void enterEnvironment(QQmlJSScope::ScopeType type, const QString &name, const QQmlJS::SourceLocation &location)
bool visit(QQmlJS::AST::StringLiteral *) override
const QQmlJSScope::Ptr m_exportedRootScope
BindingExpressionParseResult parseBindingExpression(const QString &name, const QQmlJS::AST::Statement *statement)
QQmlJSImporter::ImportedTypes m_rootScopeImports
QHash< QQmlJSScope::Ptr, QVector< WithVisibilityScope< QString > > > m_propertyBindings
void processPropertyBindingObjects()
QQmlJSScopesById m_scopesById
QQmlJSScope::InlineComponentOrDocumentRootName m_currentRootName
void importQmldirs(const QStringList &qmltypesFiles)
Imports types from the specified qmltypesFiles.
ImportedTypes builtinInternalNames()
QQmlJSScope::Ptr importFile(const QString &file)
ImportedTypes importBuiltins()
Imports builtins.qmltypes and jsroot.qmltypes found in any of the import paths.
QList< QQmlJS::DiagnosticMessage > takeWarnings()
ImportedTypes importDirectory(const QString &directory, const QString &prefix=QString())
QQmlJSResourceFileMapper * resourceFileMapper() const
ImportedTypes importModule(const QString &module, const QString &prefix=QString(), QTypeRevision version=QTypeRevision(), QStringList *staticModuleList=nullptr)
void processMessages(const QList< QQmlJS::DiagnosticMessage > &messages, const QQmlJS::LoggerWarningId id)
bool wasCategoryChanged(QQmlJS::LoggerWarningId id) const
void setCategoryIgnored(QQmlJS::LoggerWarningId id, bool error)
void setCategoryLevel(QQmlJS::LoggerWarningId id, QtMsgType level)
void log(const QString &message, QQmlJS::LoggerWarningId id, const QQmlJS::SourceLocation &srcLocation, bool showContext=true, bool showFileName=true, const std::optional< QQmlJSFixSuggestion > &suggestion={}, const QString overrideFileName=QString())
Tracks the types for the QmlCompiler.
void setIsInlineComponent(bool v)
static void resolveGeneralizedGroup(const QQmlJSScope::Ptr &self, const QQmlJSScope::ConstPtr &baseType, const QQmlJSScope::ContextualTypes &contextualTypes, QSet< QString > *usedTypes=nullptr)
void setIsComposite(bool v)
void insertJSIdentifier(const QString &name, const JavaScriptIdentifier &identifier)
bool isNameDeferred(const QString &name) const
QHash< QString, QQmlJSMetaMethod > methods() const
Returns all methods visible from this scope including those of base types and extensions.
QString defaultPropertyName() const
bool isInCustomParserParent() const
void setAnnotations(const QList< QQmlJSAnnotation > &annotation)
static QQmlJSScope::Ptr create()
const QList< QQmlJSAnnotation > & annotations() const
QQmlJSScope::Ptr parentScope()
ScopeType scopeType() const
void setInternalName(const QString &internalName)
QString baseTypeName() const
QString internalName() const
static bool causesImplicitComponentWrapping(const QQmlJSMetaProperty &property, const QQmlJSScope::ConstPtr &assignedType)
Returns if assigning assignedType to property would require an implicit component wrapping.
void setIsSingleton(bool v)
void setScopeType(ScopeType type)
void addOwnProperty(const QQmlJSMetaProperty &prop)
bool isInlineComponent() const
void insertPropertyIdentifier(const QQmlJSMetaProperty &prop)
void setIsArrayScope(bool v)
static QTypeRevision resolveTypes(const Ptr &self, const QQmlJSScope::ContextualTypes &contextualTypes, QSet< QString > *usedTypes=nullptr)
QVector< QQmlJSScope::Ptr > childScopes()
void setBaseTypeName(const QString &baseTypeName)
bool isFullyResolved() const
bool hasInterface(const QString &name) const
void setSourceLocation(const QQmlJS::SourceLocation &sourceLocation)
bool hasMethod(const QString &name) const
bool isPropertyRequired(const QString &name) const
void setInlineComponentName(const QString &inlineComponentName)
static QQmlJSScope::Ptr clone(const QQmlJSScope::ConstPtr &origin)
void addOwnEnumeration(const QQmlJSMetaEnum &enumeration)
bool isArrayScope() const
QDeferredSharedPointer< const QQmlJSScope > ConstPtr
QQmlJSMetaProperty property(const QString &name) const
static ImportedScope< QQmlJSScope::ConstPtr > findType(const QString &name, const ContextualTypes &contextualTypes, QSet< QString > *usedTypes=nullptr)
QQmlJSScope::ConstPtr baseType() const
void addOwnMethod(const QQmlJSMetaMethod &method)
std::optional< QString > inlineComponentName() const
QHash< QString, QQmlJSMetaProperty > ownProperties() const
void addOwnRuntimeFunctionIndex(QQmlJSMetaMethod::AbsoluteFunctionIndex index)
void setOwnDefaultPropertyName(const QString &name)
bool hasProperty(const QString &name) const
static void reparent(const QQmlJSScope::Ptr &parentScope, const QQmlJSScope::Ptr &childScope)
QMultiHash< QString, QQmlJSMetaPropertyBinding > ownPropertyBindings() const
QQmlJS::SourceLocation sourceLocation() const
QString baseTypeError() const
void setFilePath(const QString &file)
QMultiHash< QString, QQmlJSMetaMethod > ownMethods() const
void setPropertyLocallyRequired(const QString &name, bool isRequired)
void setBaseTypeError(const QString &baseTypeError)
QString id(const QQmlJSScope::ConstPtr &scope, const QQmlJSScope::ConstPtr &referrer) const
bool signaturesAreEnforced() const
bool existsAnywhereInDocument(const QString &id) const
void setValueTypesAreAddressable(bool addressable)
void setComponentsAreBound(bool bound)
QQmlJSScope::ConstPtr scope(const QString &id, const QQmlJSScope::ConstPtr &referrer) const
void setSignaturesAreEnforced(bool enforced)
void insert(const QString &id, const QQmlJSScope::ConstPtr &scope)
SourceLocation firstSourceLocation() const override
SourceLocation firstSourceLocation() const override
PatternElement * patternElement
SourceLocation firstSourceLocation() const override
SourceLocation firstSourceLocation() const override
SourceLocation firstSourceLocation() const override
SourceLocation firstSourceLocation() const override
ExpressionNode * expression
SourceLocation firstSourceLocation() const override
SourceLocation firstSourceLocation() const override
FormalParameterList * formals
SourceLocation firstSourceLocation() const override
FunctionExpression * asFunctionDefinition() override
TypeAnnotation * typeAnnotation
virtual SourceLocation firstSourceLocation() const =0
QStringView bindingIdentifier
TypeAnnotation * typeAnnotation
virtual void boundNames(BoundNames *names)
bool isVariableDeclaration() const
SourceLocation literalToken
UiQualifiedId * qualifiedTypeNameId
UiObjectInitializer * initializer
SourceLocation firstSourceLocation() const override
UiQualifiedId * qualifiedId
UiArrayMemberList * members
UiEnumMemberList * members
SourceLocation firstSourceLocation() const override
UiQualifiedId * qualifiedTypeNameId
SourceLocation firstSourceLocation() const override
UiQualifiedId * qualifiedId
UiQualifiedId * qualifiedTypeNameId
SourceLocation firstSourceLocation() const override
UiObjectMemberList * members
UiAnnotationList * annotations
UiPragmaValueList * values
SourceLocation firstSourceLocation() const override
UiParameterList * parameters
SourceLocation firstSourceLocation() const override
enum QQmlJS::AST::UiPublicMember::@695 type
bool isDefaultMember() const
UiQualifiedId * memberType
SourceLocation firstSourceLocation() const override
SourceLocation identifierToken
SourceLocation firstSourceLocation() const override
UiQualifiedId * qualifiedId
SourceLocation firstSourceLocation() const override
PatternElement * declaration
VariableDeclarationList * next
SourceLocation firstSourceLocation() const override
void enqueue(const T &t)
Adds value t to the tail of the queue.
T dequeue()
Removes the head item in the queue and returns it.
void swap(QQueue< T > &other) noexcept
bool remove(const T &value)
bool contains(const T &value) const
iterator insert(const T &value)
QString toString() const
Returns a deep copy of this string view's data as a QString.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
void chop(qsizetype n)
Removes n characters from the end of the string.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void clear()
Clears the contents of the string and makes it null.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & append(QChar c)
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & prepend(QChar c)
QString scheme() const
Returns the scheme of the URL.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
static const char * s_globalNames[]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
void tryGeneratingTranslationBindingBase(QStringView base, QQmlJS::AST::ArgumentList *args, RegisterMainString registerMainString, RegisterCommentString registerCommentString, RegisterContextString registerContextString, FinalizeTranslationData finalizeTranslationData)
static const QCssKnownValue properties[NumProperties - 1]
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
DBusConnection const char DBusError * error
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLint components
GLenum GLenum GLsizei count
GLuint GLsizei const GLchar * message
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum const GLint * param
GLsizei GLenum const void * indices
GLsizei const GLchar *const * path
GLsizei const GLchar *const * string
[0]
constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
static qreal component(const QPointF &point, unsigned int i)
static QQmlAnyBinding createBinding(const QQmlProperty &prop, const QV4::CompiledData::Binding *binding, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &compilationUnit, const QQmlRefPointer< QQmlContextData > &contextData, QObject *scopeObject)
static QString internalName(const QQmlJSScope::ConstPtr &scope)
void handleTranslationBinding(QQmlJSMetaPropertyBinding &binding, QStringView base, QQmlJS::AST::ArgumentList *args)
void setScopeName(QQmlJSScope::Ptr &scope, QQmlJSScope::ScopeType type, const QString &name)
QString getScopeName(const QQmlJSScope::ConstPtr &scope, QQmlJSScope::ScopeType type)
void handlePragmaValues(QQmlJS::AST::UiPragma *pragma, F &&assign)
static bool mayBeUnresolvedGeneralizedGroupedProperty(const QQmlJSScope::ConstPtr &scope)
QQmlJSImportVisitor::UnfinishedBinding createNonUniqueScopeBinding(QQmlJSScope::Ptr &scope, const QString &name, const QQmlJS::SourceLocation &srcLocation)
QString buildName(const Node *node)
static QQmlJSAnnotation::Value bindingToVariant(QQmlJS::AST::Statement *statement)
const QQmlJS::LoggerWarningId qmlUnqualified
const QQmlJS::LoggerWarningId qmlNonListProperty
const QQmlJS::LoggerWarningId qmlImport
const QQmlJS::LoggerWarningId qmlSignalParameters
const QQmlJS::LoggerWarningId qmlDuplicatedName
const QQmlJS::LoggerWarningId qmlTopLevelComponent
const QQmlJS::LoggerWarningId qmlUnusedImports
const QQmlJS::LoggerWarningId qmlSyntaxDuplicateIds
const QQmlJS::LoggerWarningId qmlWith
const QQmlJS::LoggerWarningId qmlCompiler
const QQmlJS::LoggerWarningId qmlUnresolvedType
const QQmlJS::LoggerWarningId qmlRequired
const QQmlJS::LoggerWarningId qmlDuplicatePropertyBinding
const QQmlJS::LoggerWarningId qmlMissingProperty
const QQmlJS::LoggerWarningId qmlUncreatableType
const QQmlJS::LoggerWarningId qmlRecursionDepthErrors
const QQmlJS::LoggerWarningId qmlDeprecated
const QQmlJS::LoggerWarningId qmlSyntaxIdQuotation
const QQmlJS::LoggerWarningId qmlMissingType
const QQmlJS::LoggerWarningId qmlDeferredPropertyId
const QQmlJS::LoggerWarningId qmlAliasCycle
const QQmlJS::LoggerWarningId qmlUnresolvedAlias
const QQmlJS::LoggerWarningId qmlMultilineStrings
const QQmlJS::LoggerWarningId qmlSyntax
const QQmlJS::LoggerWarningId qmlInheritanceCycle
const QQmlJS::LoggerWarningId qmlIncompatibleType
QLatin1StringView QLatin1String
#define QStringLiteral(str)
QUrl url("example.com")
[constructor-url-reference]
\inmodule QtCore \reentrant
bool contains(const AT &t) const noexcept
QHash< QString, Value > bindings
std::variant< QString, double > Value
Entry entry(const Filter &filter) const
static Filter resourceFileFilter(const QString &file)
static Filter localFileFilter(const QString &file)
const QHash< QString, ImportedScope< ConstPtr > > & types() const
bool hasType(const QString &name) const
ConstPtr arrayType() const
void addTypes(ContextualTypes &&types)
void setType(const QString &name, const ImportedScope< ConstPtr > &type)
ImportedScope< ConstPtr > type(const QString &name) const
bool isNullType(const QString &name) const
static void traverseFollowingQmlIrObjectStructure(const QQmlJSScope::Ptr &root, Action act)
static std::optional< QQmlJSFixSuggestion > didYouMean(const QString &userInput, QStringList candidates, QQmlJS::SourceLocation location)
static std::optional< QQmlJSMetaProperty > changeHandlerProperty(const QQmlJSScope::ConstPtr &scope, QStringView signalName)
static std::optional< QString > signalName(QStringView handlerName)