| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to determine whether an ID is visible from a referrer we need
not only determine the component boundaries of the referrer, but also
those of the candidate elements with the respective ID. Rewrite the
logic to have QQmlJSScopesById handle this. It has to iterate the
respective elements anyway and can therefore easily check if one of them
is assigned to an unknown property. It now provides low-level methods
that output all possible candidates for an ID, while also stating the
confidence associated with them. The plain id() and scope() methods only
return results we are actually certain about.
In places where we generate warnings or can allow for some fuzzy
results, we use the low-level methods, since those generally produce
more informative results.
The QML DOM was passing the JavaScript global object as referrer to the
scope() method before. This happened to work but was, of course, wrong.
Make sure that ID elements in the DOM receive a proper QML scope to
avoid that.
Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-140041
Change-Id: I41cf8603ae6a5d5461d3c12d74521e68b5e28ea4
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
We shouldn't include qtqml-config_p.h manually since it's not
header-guarded. And especially we shouldn't include it twice. Also,
sort and split the includes.
In order to resolve QT_CONFIG, we include qtqmlglobal_p.h or
qtqmlglobal.h.
Change-Id: I933d8eff8581e91859a8a178bf92caeec2959215
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We assume that QML or JS code comes from a trusted source. Therefore,
most files are deemed to be significant even if they parse data. This
includes the source code itself but also the associated metadata or
cache files.
However, the QML compiler also generates C++ code. Extra care needs to
be taken with the generator as a vulnerability there could propagate and
have a disproportionate effect on the program's security. It is marked
as critical.
QUIP: 23
Fixes: QTBUG-136195
Pick-to: 6.10 6.9 6.8
Change-Id: I70630361ec8e9cb3969f78a3fdf36a41334a33b3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
The win32 system headers define `interface` to `struct`. When using
unity builds, this define can leak between source files and cause
compile errors.
This patch fixes unity builds.
Pick-to: 6.10
Change-Id: I72192f406ace2bdb26e18d61fd80add26345d34a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
If a QObject is returned from a method call, the QML engine takes
ownership of it and it needs to be deleted by the garbage collector. Our
generated C++ code so far did not actually take ownership of the object
and thereby caused it to leak.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138919
Change-Id: I7bd57b3612bf4b98937756e8a7a7c03aff1c9b32
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
Keep them in a special generated struct with virtual method that gets
called from the GC for each frame.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-139059
Change-Id: I81bcbeab6531e174a5207d03f57d241461ae9ba3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
Without this, it tries to resolve the metaObject of QVariantMap, which
crashes.
Fixes: QTBUG-139626
Pick-to: 6.10 6.9 6.8
Change-Id: I9248f57c428810024f9983df959f475e6557576c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
| |
"valueType" is ambiguous. The prevailing meaning is a type that's passed
by value in QML. We mean the type of the list contents (or elements)
here.
Change-Id: Iaf4c0efe272dc6ec7511d2361e7e5ce475936fba
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
A QQmlPropertyMap can store anything, and we can't know what is
available. Treat it like QVariantMap as far as qmllint is concerned.
Task-number: QTBUG-139240
Pick-to: 6.10
Change-Id: I9ebc0a963159cfc930ff14300df50b6fab5b7035
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Amends 6575b0e835357dbf4f2a04c6df50abee4bda08ba that forgot to disable
unqualified warnings on context property calls `myContext()`. Rename
warnAboutContextPropertyUsage() into
handleUnqualifiedAccessAndContextProperties() and make it handle
unqualified access warnings when needed.
Fixes: QTBUG-138061
Change-Id: I2fe3ab2a9c2ed1329589ce67a03c1f905542793e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make QQmlJSLinter read heuristic context properties
(.contextPropertyDump.ini) files from the build
directory, by searching them with QQmlToolingSettings::Searcher.
Add a test that writes a .qrc file such that qmllint can find the
"build" folder that contains the .contextPropertyDump.ini, and make sure
that QQmlJSLinter warns about at least one context property.
Task-number: QTBUG-128232
Change-Id: I52569acc38d2fcda5015fe38ef84967353dbc21d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
| |
In HeuristicContextProperties::collectFromDirs, early return when an
empty list is given, instead of running grep without directories (which
defaults to the working directory).
Change-Id: I96647112eab74e9d68c96aaf14511f06774009d4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
| |
Introduce a new feature flag to disable the qmlcontextpropertydump tool
(that will be introduced in a later commit).
Task-number: QTBUG-128232
Change-Id: I68436f1007ec40c6b3c8e1059319156251ecdef4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add methods to write and load context properties on disk. Use the .ini
format to provide human readable files and to be able to reuse
QQmlToolingSettings for finding the setting file.
Implement a simple (de)serialization of SourceLocations for the .ini
files, and use QSetting to dump/read the lists of properties.
Add a test to see if the (de)serialization works. Add equality operators
where required for the test's Q_COMPARE().
Task-number: QTBUG-138061
Task-number: QTBUG-128232
Change-Id: I23bd2db0aacad3d395c2909efb209277f7f1d4bd
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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 <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
| |
It otherwise went unused.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I255a53247d0cfce29d958425d1f8f2895eb093e7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Windows 10 enabled support for ANSI escape sequences. Let's use them.
[ChangeLog][QML] Color ouput for qmllint and qmlcachegen is now also
enabled on Windows on terminals that support it.
Fixes: QTBUG-139228
Change-Id: I5e48e1052823ef4d0e6005482c9a1bee210e0929
Reviewed-by: Zhao Yuhang <2546789017@qq.com>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Implement go to definition for enums (values and keys) defined from C++ or QML.
This allows user to jump to their own C++ files, and does not jump to
headers outside the project folder, like private/qquickitem_p.h for
example, as it might get confusing for the user to open a file in the
editor that they are not supposed to edit.
Task-number: QTBUG-128393
Change-Id: I0410ecf4cf810e6c6072038bffc4564eb787c7fc
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
Add line numbers to qmltyperegistrar's output now that MOC includes this
information in its output.
Task-number: QTBUG-119143
Task-number: QTBUG-128393
Change-Id: Id77ef37f1503bd17fa42a355770a1ffeb348b46e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
The engine handles this just fine, and we had examples (and probably
documentation) shownig this pattern.
If we want to warn about it, it should have a dedicated warning.
Pick-to: 6.10
Change-Id: I105f4a49ecfc6fbd5f00c683e0dbef7d34a64a1d
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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 <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
| |
std::function is quite heavy-weight.
Coverity-Id: 486648
Change-Id: Ia7c61a726bde9c9d6a02412b9aa5f683bb4d355a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
| |
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 <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
| |
It seems that we grep twice when grep returns 1. From the manual, a
return code of 1 means nothing was found and in this case we shouldn't
run the fallback grep method.
Change-Id: Id8993ca914cefb8bb806f77334508be46fb60fbe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
| |
We cannot know in what context the binding will be executed.
Task-number: QTBUG-138188
Pick-to: 6.10 6.9 6.8
Change-Id: I018e931cc43cdaea052cfad41d45018fcd1193fa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
As a comment already points out, having an empty replacement message is
possible. In that case, we shouldn't attempt to print it.
Add a dedicated test-setup for QQmlJSLogger, to make it easier to expand
tests there.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138871
Change-Id: I55c5de140fe8175e9deaca519bb734654dc366f4
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
wasNotFound is defined as "was not found.". Let's just
duplicate the string.
Also remove double space due to signalName() replacement.
Pick-to: 6.10
Change-Id: Ieec4d4c02e1af16adc04b7cb0f7329a268c48c59
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Iterate through the statements of the case-statements and don't warn
about a fall-through if the code path of the case-statements return or
break or throw before reaching the end of the case-block.
Amends 65804aaa928bbf6467e22da4bd35fcae1373af2d that introduced the
warning and only didn't check recursively for break, return or throw
statements inside of case blocks.
Pick-to: 6.10
Fixes: QTBUG-138532
Change-Id: I545898ebd52a4ec8f0ea58ca4ab5519e7137b6b0
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Lars Schmertmann <SmallLars@t-online.de>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
A custom parser can do arbitrary things with signal handlers inside it,
even if no corresponding signal exists in itself. For instance,
PropertyChanges allows to set signals on its target.
Task-number: QTBUG-138173
Pick-to: 6.10
Change-Id: I8b92cb92dad8d9a53cb57b4a9ad3d2d48b24c08a
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far, resolving the id of a root element would have yielded the base
type, which is problematic when you want to expose a property of the
new type initially pointing to that id (as we do in some examples).
Fix this by inserting a mapping from the element to m_exportedRootScope,
which is the scope of the actual root type.
This is similar to what we do with inline components.
Some care needs to be taken, though: if the file name does not yield a
valid QML type, this export should not happen. We also must be careful
to do this early, before processing non-base imports, otherwise we would
end up shadowing types with the same name from explicit imports (e.g.
there's a Connections.qml file in the qmltc test suite using Connections
from QtQuick). We also must not expose types which are lowercase; not
only are those not importable according to QML semantics, but we'd also
would run into issues with "var.qml" shadowing the var type.
Pick-to: 6.10
Fixes: QTBUG-138515
Change-Id: Ie4a2c160cf9eda847da87816a88b17f6a5f3a8a3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit attempts to make the setup of the global scope more
readable, and fixes a few (currently harmless) inconsistencies:
- There's now a comment why we're creating a scope representing the
global object in the constructor.
- The setup happens on the actual scope representing the global scope,
not on m_currentScope. m_currentScope still points to the global
scope, but we prevent accidents should that ever change.
- We use enterRootScope also for plain JS files (in visit(Program *)),
not only for modules and QML filse.
- We only call setIsRootFileComponentFlag for QML files, the concept of
a root component is only well defined for QML after all.
Pick-to: 6.10
Task-number: QTBUG-138515
Change-Id: I27c0a93a201a9d25609543d6ff250f701cbeb94f
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In QQmlJSImportVisitor::processPropertyBindingObjects, we can encounter
grouped properties. So far, we used the whole compount expression to
look up the property. That would of course not find any property.
We now instead traverse the individual parts of the name, and look up
the property chain correctly on the corresponding types.
We adjust the previously added test for unknown duplicate properties to
work with _really_ unknown properties (that don't exist), and instead
use an adjusted version to prove that the example is completely warning
free – mirroring the issue from QTBUG-138164 in a more minimal way.
Task-number: QTBUG-138498
Task-number: QTBUG-138164
Pick-to: 6.10
Change-Id: I75d17c3c412159f3f6da082f54d99bdf6b3b08e4
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
We write via fwrite into stderr, but we never flush. Flush stderr on
destruction.
Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-137029
Change-Id: I72ff1fe4461b35412539120d3418037dbee84c0d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems that our attached scopes have no base type: they don't inherit
the attached properties or methods because their baseTypeName is not
set.
Therefore, set their baseTypeName, and move the resolveTypes calls
inside of setScopeName() instead of potentially forgetting them after
enterEnvironment/RootScope() calls.
With the (resolved) base type, we know about inherited signals, like
in:
```
Keys.onPressed: { /*here is the "event" argument available*/ }
```
for example where we can insert the "event" JS identifier inside the
QQmlJSScope of the block of the signal handler, now that we now that
"Keys" has a "pressed"-method with one argument "event" on its base
type.
Add a test to make sure that the body of an attached signal handler
contains the JS identifier of the arguments of the attached signal to be
handled. This JS identifier is used later on in qmlls to provide
completions in the body of the attached signal handler.
Also fix LinterVisitor::leaveEnvironment() that starts complaining
about "Component" attached properties that have no child, now that
attached properties have base types.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-137736
Change-Id: I8de0158ca9946d5e0e4f4f0a46614385f0edca69
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we have no clue what a certain property might be, do not warn about
duplicate binding assignments to it.
It might be a genuine error, but it might also be:
- a property of a type we couldn't resolve; that should warn about the
type, but not here – it might after all be a list property if we were
able to resolve the type
- a binding assignment to an instance of a custom parsed type
Note that the attached test case currently would still complain about
the property being unknown, as it fails to correctly handle the grouped
binding. That will be addressed in a follow-up commit; for now we
silence that additional warning with a qmllint comment, putting the
focus on the duplicate list warning.
Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: Ib06a4baaef0813a45a20738cbb6efe4cf5e5952c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
| |
m_foundBindings is not, in fact, a meber variable, but function local.
Adjust the name accordinglgy.
Pick-to: 6.10
Change-Id: I989ea73b5304a269425fa133c7e08a6dd9d0e765
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
| |
Amends cca050c3d4a3d1c053390e44cc174bea2c54f41d
Change-Id: I39738939343045e3534074a5525aa85cef78feb5
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
|
| |
|
|
|
|
|
|
|
| |
QDirListing is the new, preferred API. More importantly, it supports
calling completeBaseName without requiring the construction of a
QFileInfo, which shouldn't actually be necessary.
Change-Id: Ia2d60b8e3326a0628e7547154c002125c45c8dc1
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
When we renamed ScopeTree to QQmlJSScope, we didn't catch
localFile2ScopeTree. Avoid any confusion over which "tree" there might
be by adjusting the name now.
Amends d200ccf92017ebc10a4ccdb5d944e1d803b87c1d.
Change-Id: I34b99b91504d4b7a004bb80c600b4d9b8ba29fee
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
| |
Given that anything is convertible to bool (and we check that at a later
point), there's no reason to do some more narrow checks earlier.
Change-Id: I6239c66435005da427c98dc56cac2607cb45aac7
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
| |
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 <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
It is actually possible to have mutliple ValueSources on the same
propery, as long as they are not all active at the same time.
We can't really know whether that's the case (that can only be known at
runtime), but we can employ a heuristic to avoid most spurious warnings.
Pick-to: 6.10
Task-number: QTBUG-137946
Change-Id: Ie39a1368c68e1ba9aecf582df00680ae3e8c68f3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add Component line number information from MOC into QQmlJSScopes. That
is needed for qmlls to find definitions of QML components defined in
C++ headers.
This change adds the line number information into the generated qmltypes
from MOCs JSON, and reads it back into a QQmlJSScope.
Instead of adding an extra member, re-use the QQmlJSSourceLocation that
is inside the QQmlJSScope. Set the column to 1 for it to be valid and
to simplify some code on the qmlls side. This allows to treat a
sourcelocation in the same way, independently if the component described
by the QQmlJSScope was defined in QML or C++.
Avoid an assertion in QQmlJSImportVisitor::checkRequiredProperties()
where printFix assumes that a file can be opened if its source location
is valid: this change adds have valid sourcelocations to qml components
defined in C++, but QQmlJSScope::filePath() can't be opened because it
only contains the filename, not the file path.
Task-number: QTBUG-128393
Change-Id: Idf4acc32cff60730528322286ad4ba726b502ac1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
| |
Amends commit 6b14ba5c2fbc2810bb62a87008e338cca571acf6
Change-Id: Ie5ea3f735785b8acc0e4cca5de2f13e96b5cfe18
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|