| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Integrates the plugin and pass infrastructure into qmlcompiler and qmllint proper.
Plugins are searched for in the "qmllint" subfolder of the Qt installation's plugin
directory. In addition we also support loading statically linked plugins.
[ChangeLog][qmllint][New Feature] qmllint can now be extended via plugins. Use --plugins
to get a list of available plugins.
Original-patch-by: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I75a09dd978fc7724aca4931f055cc71c7ced971b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The factory should populate the pre-existing scope rather than copy it
into place. This way we can detect inheritance cycles involving the
pre-existing scope.
However, now we may detect the inheritance cycles earlier, when
resolving the types inside the lazy loading. We have the right pointers
available there now, after all. Therefore, add a way to propagate base
type errors out of the factory. When clearing the base type, we can now
give a reason for that. When checking the inheritance cycles we
retrieve that reason and log it.
We also remove the special casing of the ScopeType property of
QQmlJSScope. There is no real reason to set it in the ctor. As we
delay the population of QQmlJSScope now, we have to set it later.
Pick-to: 6.2 6.3
Task-number: QTBUG-102153
Change-Id: I49cf6e20f59fbdb6ed98a82040b3b159676f5975
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
Allows qmlls to make use of qmllint's existing autofix infrastructure
and translates them into code actions.
Change-Id: I855e131f621b16a8bb72997aa8e2b36833ac4dab
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
qmltc used .firstLines to handle Component.onDestruction, however,
we generally put that handling into the dtor of the class (as of now)
and there is nothing else stored in the dtor => we can just use .body
of the dtor method instead
Originally, .lastLines were needed to handle Component.onCompleted,
which is now handled via a dedicated method
Change-Id: Id59281be80368008cb164f7c82ce5bc2246863e5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
This should provide some idea about the high-level object
creation structure of the qmltc-compiled types
As a drive-by, mark some sections with TODOs for further cleanup
Change-Id: I821e2efe572f96cc3e1151fbbaeb407ac85f11b7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
Move code generation for top-level Component types to qmltccompiler
Change-Id: I39bd00ca02bf849b1c73479cc77ad6442e73534a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Serves two things:
a) Provides faster/more correct object creation model (long-term)
b) Eliminates (more of) prototype's code generation (short-term)
The whole object querying now works implicitly through the
std::array<QObject *> that QQmltcObjectCreationBase provides. The
creation logic is still rather recursive with regards to QML base
types processing - unfortunately, we cannot simplify this part now
as qmltc requires deeper introspection into the imported types
(this in turn requires fiddling with QQmlJSTypeReader and
QDeferredFactory<QQmlJSScope>::create())
Since we now use the new object creation pattern,
prototype/codegenerator no longer needs high-level compilation
methods. So replace prototype's code accordingly with qmltccompiler
bits. We can also de-duplicate enum and property compilation
(aliases are not touched for simplification) from prototype. Methods
and bindings have to rely on prototype and QmlIR at present, their
compilation is moved more-or-less unchanged
Task-number: QTBUG-84368
Change-Id: I584ceb8f2e3c9f3f79530b02d1c88a4f6c2d06c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
| |
Converts qmlcompiler into a shared library so it isn't duplicated when
statically linked in tools and so that plugins can link against it.
Change-Id: I91e13cc588796f71a5463dbdce21e42a74120565
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
| |
The fix and dry-run argument had broken help entries, this change fixes
this issue.
Change-Id: I744592e610f3d9941a2a54e4153cb2a92fbe9f1b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
QML types constitute a fraction of QML scopes. Since we only store QML
types internally, provide them publicly under "qmlTypes" name to avoid
potential confusion
Pick-to: 6.3
Change-Id: I7fb348324d7e807fe4e3b9c9b6b6ae4cf1f331ed
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While deeper integration requires more changes, we can already
establish the general relationship now. The idea: slowly migrate
to the proper qmltc compiler code. To achieve this, we can step
by step distill prototype's code generator in the qmltc code
generation. Right now, do it at the highest level by compiling
everything with the prototype's codegen (as before) but within
the "proper" qmltc compiler
Change-Id: I8a1e62f0559ff437ec2a4b0727147a441367c8e2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now support automatically applying fix suggestions that don't
need any additional user input. This allows us to automatically
solve issues such as unqualified access and multiline strings.
[ChangeLog][qmllint][New Feature] Added the ability to automatically
fix some warnings, use -f to automatically fix your files or add
--dry-run to see what changes would be made first.
Change-Id: I2dc7587137d74267f60c08bb94a035f1a85a62b1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
- Distill prototype/codegeneratorutil in the qmltccompilerpieces
(code generator) and prototype/codegenerator. The latter now has
the logic that is unlikely to become useful in the proper compiler
- Deduplicate property data utilities
Change-Id: I0064bd1cd3a1cb5a67216b4dba2735b9428ad63c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I3e6def56dcb9c0f5bb37bc7e0d165f8204545be2
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
- Migrate to the newer output ir classes (with adjustments)
- Deduplicate code writer and remove now-unused output helpers
from the prototype version
- Remove old output ir
Change-Id: Ie7fe5e6d47e18477c65af02cabd89a890628442c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Wrap prototype code into Qt namespace
- Move inline component logic from prototype/visitor to qmltcvisitor
and erase (for now) property method setting (in favor of the
prototype logic which is more advanced)
- Move prototype/typeresolver.cpp into qmltctyperesolver.cpp
- Delete (now useless) prototype/{visitor, typeresolver}
- Start cleaning up prototype/qmlcompiler.h
- Adjust prototype/codegenerator accordingly
Change-Id: If49d6aa8bb97093b273915caa356278ca9bbdfe1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Store the "binding content", i.e. the literal, object, interceptor or
value source in a std::variant. This saves space compared to the
previous approach (where we had individual fields), and also helps
with type-safety. We also get rid of m_bindingType, which can now be
obtained via BindingType(m_bindingContent.index()), as long as we keep
the types in the variant in the correct order.
- Remove a few methods that were not used anywhere. Those can be brought
back once we actually need them.
- Removed the setLiteral method in lieu of type-safe setX methods where
X is one of the literal types. QQmlJSImportVisitor has been refactored
to make use of this, and its parseLiteralBinding method has been
changed into a parseLiteralOrScriptBinding method. This simplifies the
control flow, and ensures that we always add the parsed binding.
- Literals no longer store the literal type (as in, the actual
QQmlJSScope pointer) themselves. Instead, literalType takes a pointer
to a QQmlJSTypeResolver, and we use that one to resolve the type on
demand.
Change-Id: I0612d49f2f46fec0fa90f0f5047d8c9f831214ef
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
| |
If you do QUrl::fromLocalFile() on a file name starting with ":" you get
a rather curious URL.
Change-Id: I07d35e792b87a66fffc9c992462d92a4c0c8040d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the filename was only available for C++ types that have been
exposed via qmltypes. Now every scope has a valid filename to reference.
This is important in order to give more useful hints to the user and
will also prove useful for debugging.
Change-Id: I6142b58278f388814514fffd86cbc241eb969bb2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
We've accidentally disabled the pragma Strict check when re-designing
the logging system.
Change-Id: I74cf0d4a45742831037ec0bc0615f1f6a15b7023
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Simple deferred properties occur quite often in QML (throughout
Qt Quick, for example), so qmltc should be able to deal with
them as with deferred properties
Ignore generalized group properties, PropertyChanges and similar
types for now. They require more testing and are well out of
scope of the tech preview
Pick-to: 6.3
Task-number: QTBUG-100053
Change-Id: I0f3588789d188cd6bec81de0b61d3205b665a917
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
When compiling for iOS the linking of qmljs tool fails with:
Undefined symbols for architecture arm64 "_qt_main_wrapper"
Fixes: QTBUG-100855
Pick-to: 6.2 6.3
Change-Id: I25a3ca9fd9d5efd2d6906087f1580b2679e6745f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
| |
Change-Id: Ib10fc05dead6fcba222b9ef4cabcb92491bbdac3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
qmltc should really interpret most of qmlcompiler warnings as errors.
There could be exceptions but for now let's just reject any malicious
code (except for ControlsSanity since it is itself malicious)
Fixes: QTBUG-100052
Change-Id: Ib18741d0a46c4d0ddb40b53e34658804c0245018
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This should just work now since the offending file is commented out as
unsupported
As a drive by, change the location of global warnings processing: we
should do it before code generation starts
Change-Id: Id0fc02dd5c8cd19090cf0382d8d4f390717f0ecd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
They were QSKIP-ed before due to issues with importing and own module
qmltypes handling. At this point this should all be fixed with proper
QML modules so no reason to leave them as skipped
In the process of doing this, also figure that attached property code
generation is borked and fix accordingly: the compiler used an
attached type where an attaching type should've been used. Given the
obvious naming ambiguity, this was likely a typo of sorts
Also as a drive by, actually write a test for private properties which
were before only covered through QQuick-based tests on anchors and such
Pick-to: 6.3
Change-Id: I1e4fd4d916ad3bd1bacf2aee1ce2346f9283c70d
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
High-level goal: be able to reuse existing infrastructure
"as is" to configure semantic analysis categories in tools
(qmllint, qmltc, qmlsc, etc.)
To achieve that, simplify the logging to always "log"
something, without explicitly specifying the severity. The
severity is now baked into the category (and we can extend
those to cover different cases)
One slight deviation is the cache generation which likes
to do its own thing at present. Provide a "forced logging"
option where we can specify which severify we want. The
hope is that this gets removed at some point
Particular list of (noteworthy) changes:
* No more "thresholding" by the level (this is rarely needed
and is actually questionable). Instead, we can ignore a
particular category explicitly
* Category levels are repurposed as category severities
(at least from the high-level picture that always should've
been this way)
* log{Warning,Info,Critical} removed. We use category severity
instead
* "category error" makes zero sense so removed: if our severity
is:
- QtWarningMsg (qmllint), it is already an "error"
- QtCriticalMsg (compilers), it is already an "error"
* Align m_output and m_{infos,warnings,errors} stored information
* Accept the fact that we don't support QtDebugMsg and QtFatalMsg
* Additional categories added to cover for places where the same
category would be both an error and not an error
Task-number: QTBUG-100052
Change-Id: I3cd5d17d58be204f48428877bed053f756ac40a8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
| |
Pick-to: 6.3
Change-Id: I05525f884f239c954527f24ad8842b108b32aff1
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
|
|
|
|
|
|
|
|
|
| |
Amends 0a1e4cc7ec7548f6273befff9cdddb0bc7a58961
Fixes: QTBUG-100469
Pick-to: 6.2 6.3
Change-Id: I6d0f48fb9b02cc9779233bbb2a93107c93b11ca4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Since all of the superfluous components of qmllint have been
removed now, we can just move what little custom linter logic
remains to qmlcompiler.
Change-Id: I91c752cb895e7d6c6f2dd4e2ccafb6cd05afa225
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds a warning if we encounter a component marked as a
singleton in a qmldir file which does not contain a pragma
Singleton entry and vice versa.
Note that the warning only gets triggered if the singleton is
actually used.
Fixes: QTBUG-98558
Change-Id: Id7c63f48ba49759c15dffcaee0270c7caab2eb7d
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
| |
It does not seem to be necessary at all at the moment. Using the TP
status of the tool, we can eliminate it now. This could always be
reverted if users needed it, but so far --resource is enough
Change-Id: I39cd2cd854d99a6eee8f6dcf49ab904aad53c241
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Similarly to qmllint, we should use QQmlJSResourceFileMapper
in qmltc. This should in theory allow us to avoid
implicit import dir vs qmldir path issues (where the former
comes from source dir while the latter comes from build dir)
At present, it does not seem to be the case, however. But
this is to be addressed separately
Task-number: QTBUG-100103
Pick-to: 6.3
Change-Id: Ie85799cb0a4b8b1620964000bc5939e9d046678e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Somehow this works (?) but is meaningless. In the (special) case of
QT_QMLTC_FILE_BASENAME it even works by accident due to the test binary
having a suitable include:
for the NameConflict.qml, which is renamed to ResolvedNameConflict{.h,.cpp}
we still have hand-written nameconflict.h
Let's ignore this mess for now (it needs to just be deleted eventually)
and just provide minimal changes for the stuff to (continue to) work
Pick-to: 6.3
Change-Id: Ic18f17463d0c60d9b02e3d3824d99605a161ae14
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make an effort to separate user-visible APIs from internal code relevant
to qmltc
In the process of doing it, make tst_qmltc_examples::helloWorld() test
less brittle by using QMap instead of QHash when dumping C++ member
functions of the type. QHash does not guarantee that the keys are
ordered while QMap does (via operator "<")
Pick-to: 6.3
Change-Id: I1495e1755d3fd77950acb3820ad2b9c5e3cdee33
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Type resolver can collect (presumably C++) type names which is needed
to verify that the QML document we are about to compile is named
correctly and does not have name conflicts
However, the collection logic gathers everything we can find: C++ names,
QML names, names marked with $anonymous$ or under import namespace. At
the same time, the way the procedure works involves poking (pretty much)
every known QQmlJSScope a.k.a. creates every type (previously some
could've been deferred) which usually means that we have a larger than
necessary footprint
Thus, delete this procedure and simplify the code. We can later revisit
the logic and figure the proper way to collect relevant type names. For
now this is just overkill though.
Note that this change, consequently, should avoid instantiating types
imported from implicit import dir, instead of imported from qmldir
(there is a difference apparently)
Task-number: QTBUG-100103
Pick-to: 6.3
Change-Id: Iaf65e5f3a9bf53286760af0dc39a1d7036d7c474
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
| |
qmlscene is not a tool. It should be built the same way no matter if
you're also building tools or not.
Change-Id: I2d83e72a4ce4df666639a1a14c70ac4a353be9d1
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
qmllint's utility is rather limited when we can pass it neither the
qmldir nor qmltypes files. Instead of trying to somehow handle the case
with ifdefs, move the feature check into the build system and
completely disable the tool if we lack the parser.
The same holds for qmltc, which is already completely unusable without
the parser (and just prints an error message if build without the
feature enabled).
Change-Id: I31828bb7d551caeaffd1974d1dff14a25446ce95
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The only place where revisions matter is at the boundary between
composite and non-composite types. The revision of the first composite
type inherited from determines which members of all composite ancestors
are available. Therefore, store the revision together with the base type
and pass it through the imports to have it available. Then use it to
check availability of methods and properties.
The test exposes two further problems, which are fixed, too:
1. If no method is found to call, we need to generate an error in the
type propagator. We don't know what the call will result in, after
all, and the code generator should reject it.
2. We need to check the right scopes for hasOwnMethod(). Otherwise we
might not find methods that are available.
Pick-to: 6.2 6.3
Fixes: QTBUG-99128
Change-Id: I4c320b8dfb490b140d7b8c16e6b638b32f156faa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
Task-number: QTBUG-94446
Change-Id: Ib8e773f97fca0d296752fd006062b5841dfd5662
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
Task-number: QTBUG-100040
Pick-to: 6.2 6.3
Change-Id: I90254b7b8079f027206121c487d974abae144644
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's tool, which means it's not built when cross-compiling. However,
it's to be desired on a target to run QML-only projects.
The earlier way to build app for a cross target was to set
QT_BUILD_TOOLS_WHEN_CROSSCOMPILING to ON. That seems like overkill.
Task-number: QTBUG-100040
Pick-to: 6.2 6.3
Change-Id: I64236fb00a5d69862ce0c34ef9afca092d5d0436
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
| |
Assigning to a QQmlListProperty does not do what you think it does.
Pick-to: 6.3
Change-Id: Ie6ac3208d552d8f40d9f2f4d7fb33c1cd64e4b79
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
If a file sets pragma Strict, it expects to be fully compiler
compliant, so let's enable the warnings for that by default.
Fixes: QTBUG-97081
Change-Id: I0b388f64d99846ee0c03e24397b3a997d4b0173b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Apparently that causes output to be suppressed.
Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-99400
Change-Id: I4ac6a66a10c7d2c27dfc1efa6d52afa60bdc58d6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
|
|
|
|
|
| |
Pick-to: 6.3
Change-Id: I51a7a063e90598dd3c68e5e430f4d73903c42957
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is a very special case that doesn't undergo a normal compilation but
instead just uses QQmlObjectCreator::createComponent() logic.
As QQmlObjectCreator::createComponent() returns a new QQmlComponent,
we can't use it within the qmltc-generated type's ctor. Instead, just
fake the same flow by incorporating the code into the qmltc type
setting
As a drive-by, fix the code to work correctly with Component roots.
This should now pretty much cover all the mystical logic of
QQmlComponentAndAliasResolver and, with tests, we can safely simplify
the qmltc code generator bits later without introducing bugs
Enhance tst_qqmlcomponent::componentTypes test to highlight that
property Component p: ComponentDerivedType {} is not marked with
QV4::CompiledData::Object::IsComponent flag at all and thus considered
to be an ordinary object binding, unlike
property Component p: NotComponentDerivedType {}
Pick-to: 6.3
Change-Id: I4ec41952d15f9659d316e44dab4050aa4908327c
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
This got missed in-between porting the prototype code to qtdeclarative
Amends e7ce5abf24f04d1b071343f07ca28b6a5d9ad4b9
Pick-to: 6.3
Change-Id: Id722b819f80b4925508bd71bd2f347a4915e330c
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
|
|
|
|
|
|
| |
Pick-to: 6.3
Change-Id: I6092dc4f2ab5bd2fcd40e5a708ccabbf2c03eafb
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can in fact get ambiguity problem (which for some reason only results
in an unused-function warning with clang 10) which practically results
in UB in the user code relying on qmltc output (due to C++ compiler
choosing the wrong function to call)
Consider the following:
// MyType.qml
Component { QtObject{} }
is compiled (by qmltc) into
// mytype.h
class MyType : public QQmlComponent {};
// mytype.cpp
static const QUrl &url() { /* return this doc url */ }
// ^ warning: unused-function
MyType::MyType(/* ... */) {
// ...
auto compilationUnitUrl = url(); // oops! QQmlComponent::url() is used
}
Pick-to: 6.3
Change-Id: Ic754ce90b66e3f371a89e2d3395ca7d6b022c694
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
|