| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change implements optional chaining (https://github.com/tc39/proposal-optional-chaining) by adding a new type of optional lookup with an offset to the end of a chain.
If `undefined` or `null` is encountered during an access marked as optional, we jump to that end offset.
Features:
- Full support for all kinds of optional chain
- With some codegen overhead but zero overhead during normal non-optional FieldMemberExpression resolution
- Properly retains this contexts and does not need to resolve anything twice (this has been an issue previously)
- No extra AST structures, just flags for existing ones
[ChangeLog][QtQml] Added support for optional chaining (https://github.com/tc39/proposal-optional-chaining)
Fixes: QTBUG-77926
Change-Id: I9a41cdc4ca272066c79c72b9b22206498a546843
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
At the moment, qmllint only check the types of objects and classes
being imported, it totally ignored types of properties that should be
also imported.
Fixes: QTBUG-92449
Change-Id: Ia5173bed84640d93fc48f6239179604ceb5db2cd
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
| |
Add the ability to individually disable and set the severity of all warnings produced by qmllint.
Change-Id: I46081f8b37fb90f8d0f4a5f2f08223d7b7285041
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
If the very first component in the member access chain is already a
QString, we need to expect "length" as only valid property from the
beginning. Like we do for lists.
Task-number: QTBUG-92447
Change-Id: I4549f4da52cb1c0968b24813f0a921a129da28ee
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Otherwise we end up with a mixture of QML and C++ names.
Pick-to: 6.0 6.1
Task-number: QTBUG-92447
Change-Id: I94c44307d8dd762d11cfd8f178f33ab6a895ee83
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The "length" property is special cased because it's the only own
property of any JavaScript built-in type. As we've changed the internal
name of the string type in builtins.qmltypes, we need to reflect this in
qmllint.
Fixes: QTBUG-92447
Pick-to: 6.0 6.1
Change-Id: I9a5c7e9ab3da686bb6ac3fdffa36269abb0eb6ea
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
This is rather dangerous since we often pass references to stack values
there. Those can easily disappear.
Change-Id: I5a57b4af9035ba032b5fd475aed6af29aa888d83
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
| |
Change-Id: I7815506eca10ae1bb444097d81a33445353ab757
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
qmllint will now warn about bindings on deprecated properties as opposed to only warning when the property itself referenced.
Fixes: QTBUG-92207
Change-Id: I93c54d55e2ab2ca0648f67ac967c792d3ba60844
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Improves the logging situation greatly by allowing all logging messages to be assigned different severities,
highlighting the code that caused them and by now ensuring a qmllint warning will always result in a non-zero exit code.
A later patch will expose more of these options to the user.
Change-Id: Id9b036fe3ba80dd18e9f8cb1b05efa891713d5a8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
| |
Pick-to: 6.1
Change-Id: I132e6e932f9501b10398939821a5818dc3cd4f6c
Fixes: QTBUG-92078
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Add a few comments to describe IssueLocationWithContext. In addition,
remove useles casts. Also remove uselessly constructing QStrings by
adding a few QStringView overloads.
Change-Id: I3c6e03f38cbe251deda66bd9257462d9ee9cd065
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously specifying any additional QML import directories would lead to the default directories to be excluded.
This can be useful if you want to run qmllint on a project using a different Qt version but
this is not behavior you want in most cases.
[ChangeLog][qmllint][Important Behavior Change] Using -I no longer excludes default QML import directories.
Use --bare to get the old behavior.
Change-Id: I2ca5789cd44306bcad54f7b1b82049c21f721d3d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
| |
qmllint will now show an information line pointing out import statements that are not needed.
It will not warn about imports that are redundant however, since there are legitimate reasons for having these.
Fixes: QTBUG-83237
Change-Id: I9588b5fa8a8efd37b48c9b349a448e580efb1452
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
The qml utility now uses context sharing by default, as previously done by qmlscene.
It can also be disabled in the same way, by specifying --disable-context-sharing.
This is needed for compatibility with QtWebEngine among other things.
Fixes: QTBUG-85107
Change-Id: I6155d32dfc55b385d33e1c805dae601b9710427e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Having those in tooling headers is not really critical, but avoids some
CodeChecker warnings.
Change-Id: I33e54ca3519b79a00d582970770e8ab0b06ca742
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds jsroot.qmltypes which represents QJSEngine's global / root object and a tool to generate it (qmlsjrootgen).
If you wish to regenerate jsroot.qmltypes run the following commands:
qmljsrootgen jsroot.json
qmltyperegistrar jsroot.json --generate-qmltypes src/imports/builtins/jsroot.qmltypes --import-name QJSEngine --major-version 1 --minor-version 0
Fixes: QTBUG-90807
Change-Id: I5ba0a048586d2dd945009d65c2b51be8ead85feb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
When ever a attached type lookup fails we have check whether combining it with the next member would make it work.
Fixes: QTBUG-83762
Change-Id: I8d159ccc07442f3939b40ea5f6b737da18439615
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Already possible to do the same using environment variables but this ensures greater compatibility with qmlscene
and better ease of use.
Change-Id: I214aec41aad4369f54bca887e91ccb879153c8be
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
qmlscene will be removed in favor of qml in the future.
[ChangeLog][QML][Important Behavior Changes] qmlscene is deprecated, please use qml instead
Task-number: QTBUG-53557
Task-number: QTBUG-53219
Task-number: QTBUG-65862
Change-Id: Ia295cdf0749ce79f6523dabebd43f0168e81c1f0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
| |
Change-Id: Ia5e1601de03aa4a925932999fb7bb5ff67daad75
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
qmlimportscanner will now relay information about whether or not a plugin is optional.
Tooling will need to be adapted to take advantage of this.
Fixes: QTBUG-91087
Change-Id: I3f4097ce797c02d9018f98f4e57453179e4f8fec
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
A linter should not return zero if it has found problems.
Change-Id: If949c5b01cd9c617d760c2c72cc7bfe29f3d3f95
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Implement the check for default properties
Default aliases are not included in this patch
[ChangeLog][QML][qmllint] Add support for default properties
Change-Id: I2d0330e32c1f49c83d3a4ed602250b6bfd4ec674
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make qmllint warn about @Deprecated {} annotations.
Also adds support for annotations in qmlcompiler.
[ChangeLog][QML][qmllint] Add support for deprecation annotations.
Task-number: QTBUG-84895
Change-Id: Ia506a6c0077a2b9ab3bf4fdac207bd0540635b30
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
All callers do have a metatype which they can query instead.
Task-number: QTBUG-82931
Change-Id: I2ff514354a43d677da963d4239333fc66a42df59
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
In other implementations this may be used the same way as qmllint's -I
option, to specify additional import paths.
Change-Id: I447712551ff1fb2a7c379712e938f778b37c514a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Since the type of a var may change at runtime and we thus can't make any good predicitons
on its actual underlying type we will ignore it from now on (as already done for variants).
Fixes: QTBUG-84060
Pick-to: 6.1
Change-Id: I36795ef2047629d3c870bf8a9df59dcd3db06633
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
| |
If a file is part of the resource file system, the implicit directory is
also in the resource file system. We can use QQmlJSResourceFileMapper to
figure this out.
Change-Id: I48d86c308c7ec38d9971b84e7f059daa3baf63ee
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
We need more generic filtering capabilities so that it can, for example,
retrieve all the .qml files in a directory, both as qrc paths and local
file paths.
Change-Id: I72a72abc6dd39adb41bcd035f7aa6777e50cb5a5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
--resource-path directly specifies the resource path for the file being
compiled and overrides any information we might retrieve from the qrc
file. However, we might still find other relevant information in the qrc
file.
Change-Id: I587c6e4e81f792f62a28b035ee97b33d12eeb06d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For each binding there should be a property and that property should
have a type we recognize.
Enums can be property types in C++. We support this by adding child
scopes for such enums. The child scopes are then referenced by the
QQmlJSMetaEnums and derive from int.
The test then reveals that we were missing a few properties in
QtQuick.tooling. Add those.
Pick-to: 6.1
Change-Id: I1deef94393ee0e17d34c2dc5980ebfbf25417f36
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Previously, all attached property scopes were just ignored.
Pick-to: 6.1
Task-number: QTBUG-84369
Change-Id: I324becf92402eacea9d150e6e51359edae562dde
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
Failure to connect within 5s is a warning now, and not affected by the
verbosity setting.
Change-Id: Ia0bace7bfbb1c7aa09642b7036344d0929f9b2b8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The "qml" tool was the only way of loading QML files that would respect
a shebang line. This is problematic as this way you cannot load such
files programatically using QQmlComponent, limiting their re-use. Common
tools like Qt Creator, but also qmllint, qmlformat, qmlcachegen, etc
would not recognize files with shebangs.
By moving she-bang support directly in the lexer all tools implicitly
support it.
Note that we could just as easily support '#' as extra comment
character along with //, but here we narrowly add support for in
the first line only, as node does (this means that javascript files
using she-bang accepted by node, are now accepted also by qml).
The only tool needing some adjustments is qmlformat, that has to emit
the she-bang again as she-bang and as first line.
Add tests for qmlformat, and sprinkle some she-bangs in the other
tests just to be sure it doesn't affect anything.
Change-Id: I1f6d881c7438bdb23163b5dbe829d59a35d11132
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
|
|
| |
We seem to be checking grouped properties twice by endVisit(UiObjectBinding*) and endVisit(UiObjectDefinition*).
So the UiObjectBinding variant is removed here as this gets run before all type information is available.
Change-Id: Idfe23869792f787df6109cde3b6bc1d96cce3dc3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
You should use qmltyperegistrar these days.
[ChangeLog][QML][Important Behavior Changes] qmlplugindump is
deprecated. Instead of using qmlplugindump to generate qmltypes files by
loading and analyzing the pre-built plugins, you should declare your QML
types using QML_ELEMENT and friends. Then you can automatically generate
the qmltypes files at compile time using qmltyperegistrar.
Fixes: QTBUG-91089
Change-Id: Iebd1b71a8e36c311d1590cb10128f9fc6d5e318c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Injected signal handlers are bad practice because they aren't declared.
Pick-to: 6.1
Task-number: QTBUG-89943
Change-Id: I3a691f68342a199bd63034637aa7ed438e3a037b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
It's easy to mess this up when you transform your signal handlers into
functions.
Task-number: QTBUG-89943
Pick-to: 6.1
Change-Id: If35be2f6828a0e19aada19abb41d8135b0c6ab45
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This collides with injected signal parameters. qmlcachegen cannot tell
those cases apart.
[ChangeLog][QML][Important Behavior Changes] QML warns about JavaScript
variables being used before their declaration now. This is almost always
a mistake. It is particularly dangerous in the presence of injected
signal parameters because qmlcachegen cannot identify a name collision
between an injected signal parameter and a variable being used before
its declaration. It therefore miscompiles such code. You can turn off
the deprecation warning using the "qt.qml.compiler" logging category.
Pick-to: 6.1
Task-number: QTBUG-89943
Change-Id: I8a9424ca8c6edd562402fe5c560ba7e8344b5585
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Keeping the parser and the code that uses the command line options in
the same function increases the number of lines for the same function,
making it harder to read, and the number of arguments for parseFile
function, makes it harder to understand and maintain.
This commit adds an `Options` struct to hold on to the command line
options and a build function to create the `Options` object.
Pick-to: 6.1
Change-Id: I5dec0a5a5e990f413ee65bf2eba2ea1087e0ea28
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
| |
The "2" is meaningless and there is a better name available now.
Task-number: QTBUG-85064
Change-Id: I65d26b06712ed7dcf2825f16dffaa6060dd86985
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
| |
Fixes: QTBUG-89955
Pick-to: 6.1 6.0 5.15
Change-Id: I89ce8a146c0ce07c8e308783f79677575458c71c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
| |
Pick-to: 6.0
Change-Id: Ie04ad4221b25628687c2575facf90488b83d21bf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, the assumption was that each object could only have a single
extension object. As proven by the new qqmllanguage test this is not the
case. Each registered object in the type hierarchy can have its own
extension. Therefore, adjust the algorithms that generate qmltypes and
iterate the extension objects when analyzing them.
This leads us to the realization that anonymous types can in fact
meaningfully carry extensions and implement interfaces. Adapt
qmltyperegistrar accordingly.
For the test to compile, however, we need to realize that the class
declaring interfaces needs to befriend all potential subclass's
QmlInterface structs. Fix that, too. The rabbit hole went deep.
Change-Id: Ia451897e927e03b95c3062e829edf1dfcd216613
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
Before, we would prepend the namespace to the name, but then continue
right away, never checking the new name.
Change-Id: If90db7d33536fb4b549321c2d6b677040605b6f0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
Fixes: QTBUG-90513
Pick-to: 6.0
Change-Id: Ic39e72d6df20be30c61123a7f8091d70dbc2d924
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
All those types are properly defined in the qmltypes files now. We just
need to search the enumerations the same way as methods and properties
in order to find everything.
Also, deduplicate the code that resolves properties, methods, and enums
by using a common template for iterating the scopes.
Change-Id: I0bf1423974d0ec8f602ecd0342522b3e981a8586
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
Fixes: QTBUG-90448
Change-Id: I5fb6b3d9223ae95ca7e039c5b9139ed086052c29
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Remove all qmake project files, except for examples which are used to
test that qmake continues to work.
Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|