| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Hints are no longer their own fix suggestion but instead are part of an
existing one. This breaks compatibility with the existing format but as
the output is not documented and is versioned this should be ok.
This change will enable having multiple fix suggestions per warning in a
future change.
Pick-to: 6.10
Change-Id: Iedf275507554a2d70399757396e278999874cd53
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since 6.10 Qt i18n component allows mixing id based with text
based translation and this is reflected in lrelease, lupdate,
and documentation.
This patch is a partial revert of
8b61addfa42525c1bd5f27febbe62dcbdb645fc9 and removes the
qmllint warning in the case of mixing these two.
Pick-to: 6.10
Change-Id: Iae2407da2bc5cc21fc3664051834c99b8c72fe58
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
| |
We have already dereferenced passMan a few lines before and that
obviously succeeded.
Coverity-Id: 486649
Change-Id: I36dcef5757013acf98d665396a3f8f3d289bfee1
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prepares for QTBUG-138061 where we need a way to load user-defined
context properties into QQmlJS::ContextProperties.
Rename QQmlJS::ContextProperties into HeuristicContextProperties to
avoid confusions with the UserContextProperties.
Make HeuristicContextProperties a real class so that we can add methods
to load and save context properties to and from disk.
Make the heuristics be saved in a list instead of a QHash, as the order
of the property matters as we write them out into a file and testing
becomes complicated when the order changes between different runs. Also
note that it might be confusing for qmlls users if their warnings change
orders during multiple runs.
Rename some methods for clarity.
Task-number: QTBUG-138061
Task-number: QTBUG-128232
Change-Id: Ib6302f609e182e622015293366c8b42425566a0e
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow the user to specify context property names in .contextProperties.ini
files so that they can disable all warnings or only the unqualified warning
on their defined context properties by name.
I remember some use cases where checking the .qmllint.ini into a users
project repository is unwanted, so use a new setting file for the
context properties that does not mess with global/system-wide
.qmllint.ini files when checked into the repository.
Create a new class called UserContextPropertiesSettings that is in charge of
loading user context properties setting files, and use it inside of
QQmlJSLinter.
Introduce a ContextPropertyInfo class that contains both the heuristic
information and the user-provided information. ContextPropertyInfo is
used to pass the ContextProperty information down the type propagator.
Also add some documentation for the new settings file.
Task-number: QTBUG-138061
Task-number: QTBUG-128232
Change-Id: Icd700154dc89219f115fa3187c037d65451d0059
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While there is a goal to phase out BINDABLE only properties in QML, and
require NOTIFY (if they participate in a binding), we are not there yet.
Given that this is not documented outside of wiki.qt.io, and we still
had Qt internal properties without NOTIFY (but with BINDABLE), we
shouldn't warn about it right now.
In the future, we should provide a more specific warning; which then can
also add more details about the integration of signals with QProperty.
Pick-to: 6.10
Change-Id: I5070c47124787938ef3ba5143a02574663de1cf6
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We emit all warnings with QQmlJSLogger, so don't use qWarning() for
parser warnings.
This makes our parser warnings more beautiful because QQmlJSLogger can
print the code around the invalid token, for example on unexpected token
errors.
Also make sure that we use the correct logger to emit the parser
warning.
Pick-to: 6.8 6.9 6.10
Fixes: QTBUG-137029
Change-Id: Ibf2a24cd17c20edac3c20dd44185f18e891eab66
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When file selectors are used, we loose too much information currently,
as we completely discard everything we know about the type.
[ChangeLog][qmllint] qmllint and the LSP now no longer print warnings
about ambiguous types if file selectors are used, and instead use the
"plain" version. The QML script compiler will still conservatively
reject such QML files. If warnings about such cases are desired,
the new "importFileSelector" warning category can be enabled.
Task-number: QTBUG-137075
Pick-to: 6.10
Change-Id: Ia87d5ab62003fe8d7d2ab9569fac2942fb1c7c14
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Instead of doing string comparisons, encode the information in the scope
type for bindings and signal handler functions. Add a helper function to
check whether a scope represents any kind of functions.
Change-Id: I41ad1316852dd484ac54c02f99bb25e618099e62
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It doesn't cause any harm if we are not inside a binding. There's a
slight issue with the fact that we now don't warn if one extracts the
read into a separate function, and calls the function inside a binding,
but that is still better than spurious warnings.
Fix this by checking in which context the read occurs. We currently rely
on a "magic" name we give to the function's scope if it as a binding,
but this will be fixed in a follow up commit introducing new scope
types. We don't want to do introduce them here, as they would be new API
not suitable for picking back to 6.10.
Another open issue is that the onRead handler gets the outer QML scope
as the context, which necessiates that we traverse its child scopes to
find the actual function. Fixing that would necessiate some larger work
in the QQmlTypePropagator, and is consequently deferred to another
patch, too.
Pick-to: 6.10
Fixes: QTBUG-138346
Change-Id: I29ea39eb32a18d9b54ded8d5e2c9a5f66051374f
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
| |
This mirrors the work on QQmlJSVisitor, and has the same reason: It
becomes possible to track which calls update an existing scopes, and
which calls create a new one.
Change-Id: I98f13f8ed2da436510d11c0e2203ea4b23cdf8ed
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warn in QQmlJSTypePropagator::generate_LoadQmlContextPropertyLookup()
about usages of context properties that were found. Also treat context
properties as var.
Add the (C++) location of the "setContextProperty()" call to the
warning, and also hint that a property is assumed to be a context
property when inside a top-level component (capital C Component, inline
component or implicitly wrapped as component) because it is not
declared as required property.
Still print the accompanying unqualified warnings next to the new
context property warning.
Add a test.
Later patches will add the support to qmlls and qmllint by passing
the workspace folders to the new functionality.
Task-number: QTBUG-128232
Change-Id: I26e39e0bce8c6e9f203962a091209c7acd15d445
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
| |
Task-number: QTBUG-129307
Change-Id: I95f633299ca94cb27c545a97a465bb5e24b5e3e8
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Add a visitor that creates warnings about qml and js code, to avoid
having all the warning-related but qqmljsscope-unrelated code in
qqmljsimportvisitor.
Task-number: QTBUG-129307
Change-Id: Icf56979d99855f11c5e72a0c9efbf9ecd629e42e
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
| |
The binding might not update if their value changes.
Fixes: QTBUG-112508
Change-Id: I27801d662117a89c0fdddc2aaa2f1dde21b238df
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The compiler is very polite and does not tell the user about its useless
code. Codegen::statementList(StatementList *ast) silently discards
unreachable statements during byte code generation.
Warn the user that their code is unreachable. Don't warn about
function definitions because these ones are "hoisted" up,
which means that their definition is supposed to be pushed up, so that
they can be used even if they are behind a "return" or "throw"
statement.
Don't use the qqmljsbasicblock analysis for that, it reports too many
"false positives" where the compiler generates dead code that can't be
fixed by the user.
Task-number: QTBUG-129307
Change-Id: Ia26e8af1adf4e63b26dcaa7fb10be73b7eb084d7
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warn about functions used before their declaration. Its not technically
an error like the "var used before declaration" because functions are
"hoisted up" and therefore available even before their declaration, so
create a new warning category for it instead of reusing the "var used
before declaration" category. Disable the warning by default: Qt Creator
used to have it as default, while other tools like eslint don't.
For the same reason, don't warn about functions used before declaration
during codegen, and add a method to warn about it in
CodeGenWarningInterface. The code for "var used before declaration"
can be reused by function declarations by adding a sourcelocation for
function declarations in the "addLocalVar"-call, so make sure to
differentiate between functions and vars by adding an extra member to
Context::ResolvedName.
Task-number: QTBUG-129307
Change-Id: I83a4f8cd00c120db23a0cec3365a00ed44de2836
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up QQmlJSLinter::lintFile a bit. Add an early exit to decrease the
indent for the qml file linting code.
Remove the huge "check" lambda: instead, create an optional
QQmlJSFileResourceMapper to support both use cases of linting with or
without file resources. This makes the lambda useless, so remove the
calls of the lambda and move the lambda code directly at the caller
site.
Change-Id: Ib268f3e40d945f41710675f2bdb534aa62a599f0
Reviewed-by: Olivier De Cannière <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It doesn't really make sense to print out the location of the variable
declaration, especially in the language server. Instead, emit two
warnings: one at the declaration and one at the usage. This makes it
easier for users to spot the location of the declaration.
Add a test to make sure that both warnings can be disabled with one
disabling directive.
Task-number: QTBUG-129307
Change-Id: Icb485ee37f016f18395c3016672e397c4f5e6024
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Complain about usages of Eval in qmllint, and make the
qqmljstypepropagator analyze eval calls.
Task-number: QTBUG-129307
Change-Id: I577612220383c624e960db60ed755e0f2dbc59aa
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
| |
Change-Id: Ib83c8d3452d5a0521295750f068f429b414da6ff
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We should only have one way to handle diagnostic messages: The
QQmlJSLogger. In addition each compile pass may result in an error that
prevents the running of further passes. But that error should not rely
on the selection of messages posted earlier.
For this to work we need to introduce a further state transition into
the logger. The logger now "archives" messages after compiling each
function, so that only the current function's compile errors are taken
into account as result of the current function's compilation.
Task-number: QTBUG-124913
Change-Id: I4b6d9910b80527cefb1aba02598114d1fe5ba172
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Certain compile passes may be run multiple times and only the last run
counts. We need to be able to roll back the logger to the state before
the pass in that case.
Amends commit d70abd83dc94d722cde6d4b19b9d35c5f4f19946
Pick-to: 6.9
Task-number: QTBUG-124913
Change-Id: Ie6174fc3d6ce60ca3f0a3fa27484a58e6febcc17
Reviewed-by: Olivier De Cannière <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems that mixing different translation functions (id-based with
non-id based translations) is not supported in the same qml file.
Therefore, emit a warning when mixing up id and non-id translation
methods.
Currently, it is not possible to have warnings for mixing usages of
QT_TRANSLATE_NOOP(), QT_QSTR_NOOP(), QT_QSTRID_NOOP() but that
should not be too important for the actual feature, as calls to
QT_QSTR_NOOP and QT_TRANSLATE_NOOP only make sense when there is
a qsTr or qsTranslate around.
Add a QEXPECT_FAIL test for that.
Task-number: QTBUG-129308
Change-Id: I8b19ca997cd6b4b8619c53c079dd72b9510fb904
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for a critical error category in qmllint called "error",
so that the qds plugin can show errors for unsupported components for
example.
Add a test. The error category makes qmllint return -1.
Simplify a bit the logic of the "success" bool in lintFile() by making
it a LintResult and returning it.
Change-Id: Ide6a6a265f1aeede0fcbc35d9e4d0abe3f5c2aa3
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make qmllint load plugins from the same default directories as
QFactoryLoader does, in addition to the extra paths passed by
command line arguments to qmllint. Remove the static helper
method to get the custom qmllint default plugin directories and
use QCoreApplication::libraryPaths() instead.
This allows to ship the qmllint plugins with qmlls's standalone build,
because QCoreApplication::libraryPaths() contains the
current application path and allows a standalone qmlls to load plugins
for linting or completion from a subfolder.
Fix tst_sanity to continue ignoring the warnings from all other plugin
as QQmlJSLinter will load all available default plugins now, like the
Quick plugin for example.
Change-Id: I9edaddb0fd5da27f68da9ceca76a9351fc0c6aee
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prefix the logging category name with the plugin's name, in the same way
as the category id's are also prefixed.
Fixed a test from bc709184afcb8373be6d69309cb53294455d7248 that did not
test anything. Add a flag to callQmllint() that enables to read settings,
and make sure that a warning is actually emitted when the settings are
not read for the settings/plugin/elementPass_pluginTest.qml file.
The latter file was also renamed because the test lint plugin only
enables itself on files ending with "pluginTest.qml".
Add a compatibility mode that allows loading "old" .qmllint.ini files
where the settings names do not contain the plugin name.
[ChangeLog][Important Behavior Change] Qmllint prefixes logging
categories from plugins with the plugin name in .qmllint.ini files.
For example, PropertyChangesParsed=disable becomes
Quick.PropertyChangesParsed=disable.
Fixes: QTBUG-130357
Change-Id: I47a0bf22991d6a438aa3371c666da34f2c2835bc
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
This is done in prepartion for the following patch in the chain.
Pick-to: 6.8
Change-Id: If8ce75be8ba00e7e4cdd5a0f5e66319ab0d36755
Reviewed-by: Sami Shalayel <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
| |
Add a defaultLevel value to the .json file shipped with the plugins that
allow plugins to set the default level of their categories.
Change-Id: I4a13366ce705ba104414b41e729d12769ab83821
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Add a flag to the QDirIterator as only files can be loaded as plugins.
Discovered while debugging as this iterates also over "." and ".."
without the flag.
Change-Id: Ia1070b40541b8c769a457143978576b05c84e2bf
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
We want to replay the warnings when we import the same module again.
This happens if we lint multiple files with different imports, some
direct and some indirect.
Pick-to: 6.8
Fixes: QTBUG-118588
Change-Id: I75da4e62acea675342ce8f86f9609f1786ffbdd0
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, qmlls (like all the other tooling) was only working on the
build folder for imports. This leads to bugs like QTBUG-127661 where
go-to-definition jumps to the build folder qml file.
This commit changes the Dom to use a "best of both worlds" approach:
import .qml files from the source folder but load the rest (qmldir,
qmltypes, ...) from the build folder.
Add a flag to QQmlJSImporter that enables the build-folder-path-to-
source mapping, and use it in the DomEnvironment::SemanticAnalysis's
importer.
In the qqmldomastcreator, load the implicit import directory from the
build folder instead of the source folder, and explicitly load qmldirs
of that implicitly imported directory to make the implicit directory
import actually do something.
In DomEnvironment, map files from the build folders (for example loaded
via a qmldir from a build folder) to their source folders before loading
them..
Finally add a test to make sure that go-to-definition jumps to the
source folder instead of the build folder qml file.
Pick-to: 6.8 6.7
Fixes: QTBUG-127661
Change-Id: I764826a7d3c98d2e34e5af8e3ba6dea1526c593c
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
| |
This can lead to crashes in static analysis passes when they try to use
the resolver.
Pick-to: 6.8 6.7 6.5
Change-Id: I2f7951374a3aa6bd38ef93333b97b08d9a46dd13
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's not accessible via public API, but it risks wrecking havoc on
internal plugins, and would also likely cause issues if we were to
expose the global JS object to QQmlSA plugins.
The current fix is rather a minimal workaround, we should revisit
whether codegen should really take ownership of the typeResolver.
Pick-to: 6.8
Change-Id: I6ca6e78527ce886155cfc0a21038348da2982c03
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Now developer build tests compile, but some are not working.
Functional fix will come later via separate tasks.
Task-number: QTBUG-122999
Change-Id: I0a0dfcf7affb73f928b8be62b3576a6a51658488
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use the private API to convert QQmlSA objects into QQmlJS elements
wherever it was not possible to use the QQmlSA objects:
The static method canConvertForLiteralBinding has a comment that seems
to say 'we need this so dont touch this' so do not change its code.
Furthermore, it requires a QQmlJSTypeResolver, so obtain it from the
PassManager's private struct.
It seems that QQmlJSLiteralBindingCheck was the only user of
QQmlJSMetaPropertyBinding::literalTypeName, so move it to
QQmlJSLiteralBindingCheck instead of adding literalTypeName to the
QQmlSA interface.
Make QQmlJSLinter always create the passManager, even when there are no
plugins available, such that the QQmlJSLiteralBindingCheck can be run
using the QQmlSA interface. Also fix Qmltc to use the new
QQmlJSLiteralBindingCheck api.
Change-Id: I27dfc63d411e38740e2993ccf9af352271ae6d47
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
There can be multiple places that suggest the same fix in a file. We
only want to apply it once.
Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-118982
Change-Id: Ie14bf5904c7480074c44f80bb855d28e9b132588
Reviewed-by: Sami Shalayel <[email protected]>
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Methods you can't use should not be visible, and PassManager needs to be
Q_DISABLE_COPY_MOVE.
Task-number: QTBUG-116682
Change-Id: Ib308bf3a5bac3dd78b52b82b01bc8f2bc13835b3
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
We weren't actually considering the sections name from the json config
file. Fix this, and only use the CLI option name as a fallback.
Pick-to: 6.6 6.6.0
Change-Id: Ieb88d4840164d903c228ec39ce9943715221ca92
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds abstractions for QML Elements, Bindings, Methods and
Properties. This abstraction layer avoids exposing internal details and
should be more suited for static analysis tasks. It is now possible to
write qmllint plugins without including private headers.
As a drive-by, change tst_qmllint:verifyJsRoot to open files in text
mode instead of binary. This fixes an issue where line endings cause
issues on Windows.
Fixes: QTBUG-102276
Change-Id: I6b6e53f1e0078734a18f3aa51807fbe875b375f0
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the detection into the QtQuick lint plugin. It's mostly meant for
QQC, so let's auto-enable it for attached types derived from
QQuickAttachedPropertyPropagator.
To this end, two new categories are introduced: The Quick lint plugin
gets its own attached-property-reuse category which is synonymous to the
default category of the same name. Furthermore, we add a
controls-attached-property-reuse category for only checking controls.
That one is implied by either of the others.
Finally, fix the id vs. scope resolution to actually do something.
This way we can give appropriate hints when the outer type has an ID
already.
Pick-to: 6.5
Fixes: QTBUG-110834
Change-Id: Ib71a9e3bbc10bac77f36db6cc441af88df20fd33
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
In this form we can expose it in QQmlSA.
Pick-to: 6.5
Task-number: QTBUG-110834
Change-Id: Ieb0cf31b6e86379c0d80f89bc6c63b129f269798
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Those are just as important for modules as for single files.
Pick-to: 6.5
Change-Id: I201d62c61988abc2dfba6300a1cfc355203fec75
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
| |
Pick-to: 6.5
Fixes: QTBUG-104643
Change-Id: I5ca0fea2ef6f822b70c08bc6e49f0d07a732b299
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, there were four lists that contained each one entry
for each parameter. There was one list responsible for the names, types,
type names and const-qualifiers but this was quite bothersome to use
(e.g. they not always had the same length).
This commit introduces QQmlJSMetaParameter to
encapsulate all the information required when manipulating parameters.
This reduce the 4 lists to one, making parameters easier to handle
and QQmlJSMetaMethod easier to read.
This is a purely refactoring change, no new functionality was added.
Task-number: QTBUG-107625
Change-Id: Ia41b823c9e6294ee26e828071b802cac6b4058ce
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An instance of ContextualTypes can only either hold QML types or
internal types. We always need an integer and an array type, though.
Previously, "int" was always added to the used types when it was looked
up for potentially resolving enums. This prevented the builtins from
being reported as unused import. Since we pass "int" as a separate
member now, prevent the builtins from being recorded as import location
in the first place.
Task-number: QTBUG-107171
Change-Id: I288b6e070c2039d4ac85073886c9929a2eed3998
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code in qmlcompiler working on ContextualTypes is very confusing
as it handles internal types (c++ and synthetic jsrootgen type names)
and qml types at the same places.
Furthermore, some methods like qqmljsscope::findType() have different
behaviors when running in different contexts, e.g. in the internal
type context it needs to lookup namespaced c++ enums (e.g.
QQmlComponent::Status) while in the qml type context it needs to
lookup inline components (qmlFileName.MyInlineComponent).
Changed ContextualTypes to be a struct with the types QHash and
an enum with the context (QML or INTERNAL),
Drive-by change: amend the iterations over types.keys() to use an iterator
instead of allocating a temporary QList as types is not that small
(may contain around 400 items just for the builtins).
Fixes: QTBUG-107191
Change-Id: Ib463ec873019ea1e6844c522a090030e9a44d53f
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:
auto QtContainerClass = anyOf(
expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.
Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Opening input files in binary mode may cause file to be parsed
incorrectly. To prevent the crash, Check if element in container is within the range
of valid elements before accessing it. Note that qmllint will ignore the comment
directives and may not function correct in that case.
QTBUG-106813 should solve this.
Pick-to: 6.4
Fixes: QTBUG-106613
Change-Id: I1a5705474905a747fbcc4874c3ff2038f539f42f
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Qt's asKeyValueRange of associative containers cannot return references
to key/value pairs, so Apple's clang warns when using ranged-for with
references to elements.
Use a structured binding instead as the loop variable, and delay some
conversions of QSet<QString> to QStringList until the list is needed.
Change-Id: I37aa101e6d9cd008cde0c2db790132dc051a249b
Reviewed-by: Ulf Hermann <[email protected]>
|