Commit Graph

229 Commits

Author SHA1 Message Date
Thomas Hartmann
35118c2520 QmlJsCheck: Do not allow print as id
Task-number: QDS-4162
Change-Id: I425c75cd42c0842ead27a6c801c3a483284407ea
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-16 07:53:00 +00:00
Fawzi Mohamed
7015ef04b7 qmljs: add check for comparisons not depending on values
currently we mainly try to warn about primitive == null/undefined or
primitive === non primitive.
There are other that we could warn about null==null null==undefined,
but I feel that they might be triggered too much by clean code.

Change-Id: Id43d838d60a4e13f361be34e4bb38211777a081e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-03 14:05:16 +00:00
Fawzi Mohamed
cc00af8334 qmljs: fix qmljscheck
* fix ASTVariableReference::value: correctly get reference value type
by using either initialiser of bindingTarget (broken since a codemodel
update in 2018)
* disable warning for casting in bool to null comparison (it does not
cast, is always false)
* fix property checks (where skipped without default of readonly)
* remove non relevant checks (ErrInvalidPropertyType for lowercase  now that custom
value types are supported, and for properties called data)
* updated import version

Change-Id: I38407acf327d0f773b38dda4c02fb4d95a420851
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-03 14:03:44 +00:00
Eike Ziller
cf2a651c3b Make QmlJS(Tools) build with Qt5 & Qt6
Port from QStringRef to QStringView

Change-Id: I472d16f20e40ca52b8e5d481850a6bd8a1a38f3b
Reviewed-by: hjk <hjk@qt.io>
2020-09-17 09:37:23 +00:00
Thomas Hartmann
f641434ec1 QmlJSCheck: Fix crash
Task-number: QDS-2766
Change-Id: I4b0e81b8104ac35a286a318e87e95ea022ed66f6
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-09-14 12:21:49 +00:00
Thomas Hartmann
356acf16b8 QmlJSCheck: Workaround for ListElement
When editing QML there are false positives reported
for ListElement.

Task-number: QDS-2602
Task-number: QDS-2716
Change-Id: If3fc297d6609213448f8353e9406b3f0aaf65870
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2020-09-03 11:22:32 +00:00
Fawzi Mohamed
1ea9d6ce87 qmljs: fix unreachable test for catch clause
Change-Id: Ica1ff034b88f06849026957c8beed2cda77badcc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-03 06:31:08 +00:00
Tim Jenssen
b8cd87dea0 Merge remote-tracking branch 'origin/qds-1.59' into 4.13
Conflicts:
	src/plugins/clangformat/clangformatplugin.cpp
	src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
	src/plugins/qmldesigner/qmldesigner.qbs

Change-Id: Ie4a0beeb9fd32ac9683f4e8769988a9c3f3e369a
2020-06-26 16:51:22 +02:00
Tim Jenssen
5a06305ffe qmldesigner: enable Transion in QmlUi files
Change-Id: I2e35e8a2dc7b946297c70fd775bd3e3366295271
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-26 12:38:18 +00:00
hjk
54575fe42d QmlJS: More Qt6
Mostly QRegExp, one QHash::unite.

Change-Id: Ia2816fee65b9459c0f89419161f44c38cd572c36
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-19 07:13:06 +00:00
Thomas Hartmann
afb499a138 QmlJSCheck: Add Error message for recursively instantiated type
Change-Id: I68b46a929c65fb21ee8473cda44f7de4e40009c7
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-04 13:45:56 +00:00
Tim Jenssen
8573623c6e QmlJS: remove unused QtQuick2 check
Change-Id: I7d613ba825a5ce3d4d8302adff9c98f751bc7ab1
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2020-03-06 14:06:54 +00:00
Fawzi Mohamed
b09a48599e Update qmljs parser to Qt 5.15 parser
* parser side support for annotations, inline components, new UiVersion
  and all the things included in QT 5.15 parser
* SourceLocation moved from QmlJS:AST to QmlJS
* Visitors now need to handle throwRecursionDepthError
* BaseVisitor for visitors that want to override all visit

Task-number: QTCREATORBUG-23591
Change-Id: I682a30d0b08b6c929739fd0e339ef6fbde3eb630
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-03 15:31:10 +00:00
Thomas Hartmann
bbf5ff61ea QmlJSCheck: Allow animations in ui.qml files
Task-number: QDS-1613
Change-Id: I4beecff16d0b67652abbdb16945614d2497d3921
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-02-19 15:47:14 +00:00
Christian Stenger
6b492866af QmlJS: Add check for duplicated import
Add a soft check for duplicated Qml/JS imports which
adds a warning when a file contains imports that
duplicate the same URI / version or file path.

Change-Id: Ib9a1f8a90dd3cf469d90e83abc1d748901b1e353
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2019-12-16 06:28:20 +00:00
Tim Jenssen
8ebcef7b51 QmlJS: Add "Symbol, Object, Function, RegExp" to global functions
This fixes a false positive error message.

Task-number: QTCREATORBUG-22599
Change-Id: Ibdf9a3a6b1679bd11afa87ca3d5e77fcda773ce0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-12-06 10:57:12 +00:00
Ulf Hermann
58d35f8a64 QmlJS: Update QML parser using the one from qtdeclarative 5.15
We need to do this because the new "required" keyword should be
recognized by Qt Creator.

This is not a verbatim copy of the QML parser from qtdeclarative. A few
data structures have changed that would require large scale changes in
otherwise unrelated parts of the code. For example, all Visitors need to
handle recursion depth errors now and the DiagnosticMessage only has
line and column now, no longer begin and legth.

Change-Id: Iea5b04e27b07e0cba55d64b844315af9828acbf7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-10-07 07:33:58 +00:00
Eike Ziller
8df0653bf8 Merge remote-tracking branch 'origin/4.10'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/projectexplorer/gcctoolchain.cpp
	src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp

Change-Id: Iffdf48e782a734107ea170ebb3812e997cea0e7b
2019-09-12 09:08:04 +02:00
Thomas Hartmann
4bf1474aa0 QmlDesigner: Allow transformations in Qt Quick Designer
They are passively supported and we plan better support in the future.

Change-Id: I22520335ae3dba5804ec4c8902624b4afe4254a3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-09-05 12:47:03 +00:00
Eike Ziller
8d85a7c2bc QmlJS: Fix compiler warnings
Change-Id: I94fccd913a4a06fb55acee3df974859f9a163b4f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-09-04 10:11:48 +00:00
hjk
e3b1106afa Compile fix with recent Qt dev
The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 08:54:18 +00:00
hjk
6a58666f44 More Utils::toSet/toList
... and unrelated cosmetic changes.

Change-Id: I591b17fd5289831e701b683f8fb47816efd1fa67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-04 12:28:38 +00:00
Thomas Hartmann
a540216549 QmlJS: Add "Array" to global functions
This fixes a false positive error message.

Task-number: QTCREATORBUG-22599
Change-Id: I54104857982873baaa092ad936586c3d245ce720
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-21 13:34:10 +00:00
Christian Stenger
06d8df7ee6 QmlJS: Fix wrong warning
Variable declarations made with let or const need
to get evaluated on block level base.

Task-number: QTCREATORBUG-22054
Change-Id: Ia1d353be61c2d9532bc54257c15d00fb33ea156c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-05-16 05:01:15 +00:00
Eike Ziller
ce888b45ef Merge remote-tracking branch 'origin/4.8' into 4.9
Conflicts:
	src/libs/qmljs/qmljscheck.cpp

Change-Id: Ib3d97e8e59463185e2fa4663ae594c1e29b4b337
2019-03-11 11:38:03 +01:00
Kai Koehne
37eb282313 qmljs: Fix variable name
Change-Id: I8ea8d18e0471071f3a7a22760c041ecf77dbbe8c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-03-07 19:14:28 +00:00
Tim Jenssen
d4beced19f QmlJS: modernize the code a bit
- use nullptr instead of 0
 - remove all QLatin*
 - use initializer for QStringLists

Change-Id: I62db000e2644d1d2a2c1246e70e829e37d36f2f3
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-01-18 12:20:37 +00:00
Thomas Hartmann
b6868f2316 Fix warning
Change-Id: I646cf0d1c1e7dec7f44baf50a586ff22044cb7f0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-18 09:21:57 +00:00
Orgad Shaneh
d1a0479c98 QmlJS: Fix unused variable warning
By using it.

Amends commit 66dc5e9713.

Change-Id: I21bfb7a2d83987f095bfd02b0cc20931e0feb68b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-01-18 08:38:11 +00:00
Eike Ziller
413c5c3b8a Merge remote-tracking branch 'origin/4.8'
Change-Id: I400217ba1c8a531e0450c3012a07db3fc93638cf
2019-01-17 12:04:35 +01:00
Thomas Hartmann
66dc5e9713 QmlDesigner: Allow more JavaScript functions
Task-number: QDS-355
Change-Id: I0f330216b0120857f21b804236d2e3338c812749
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-01-16 13:50:57 +00:00
Marco Benelli
cd9ab31093 qmljs: do not raise warning for yield statements
Task-number: QTCREATORBUG-21301
Change-Id: I2b358039f808faf8f979eb21410fa827cc132a57
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-12-07 13:49:06 +00:00
Marco Benelli
4646acad0d qmljs: update parser
Update the qtcreator qmljs parser to the
one of Qt 5.12. It supports EcmaScript 7.

Task-number: QTCREATORBUG-20341
Change-Id: I0d1cff71402ba17e22cde6b46c65614e162280de
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2018-11-22 11:21:32 +00:00
Alessandro Portale
4b13170565 qmljs: Use C++11’s override and remove virtual where applicable
Fixes warning: prefer using 'override' or (rarely) 'final' instead of
'virtual' [modernize-use-override]

Change-Id: I17955fd0fdb052678228f1bda32cd8d3b4298998
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2018-06-26 10:38:38 +00:00
Marco Benelli
b9d72a5737 qmljs: remove remaining references to QtQuick1
This patch removes all references to QtQuick1 in qml library,
plugin, designer, profiler and tests.

Change-Id: Ie286fad96060299caae3ef328330597cf53e90d3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-04-03 14:40:30 +00:00
Thomas Hartmann
3b1e0e070a QmlJS: Allow NumberAnimation for ui.qml files
Change-Id: I12836a2d7708d50278715139f0cfba5fa221f8eb
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-03-07 14:13:08 +00:00
Marco Benelli
2acb365dac qmljs: relax checks for qbs files
Types information for qbs is more limited that qml; this causes
qtcreator to raise false positives.  This patch relax the checks and
provide some type information needed by qbs files generated by the
wizards.

Task-number: QTCREATORBUG-19757
Change-Id: I07a1dd9d8fedaf4c5c751c2f00643f15ae39127a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-02-27 15:17:44 +00:00
Thomas Hartmann
6a738504d0 QmlJS: Add error message for dynamic property called "data"
The default property of most QtQuick items is data and
therefore "data" should not be used as a property name.

Task-number: QTCREATORBUG-19225
Change-Id: I54d1b72ce984debd4c366b7261e93b7a81b8c940
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-11-06 16:41:07 +00:00
Marco Benelli
65b2edbd82 qmljs: better handling of attached properties
Attached properties used to cause false positives in the highlighter,
because when using qualified ids, only the first part was checked as
candidate for being at attached property.

Task-number: QTCREATORBUG-18707
Change-Id: I6b1b569bc1766325decbc5d100c16a4e0dc3634f
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-09-19 08:04:36 +00:00
Eike Ziller
d8fd5292f1 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	src/tools/clangbackend/ipcsource/clangiasyncjob.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.h

Change-Id: Ib8602530663813ade418f995dfd2a736908cfe75
2017-08-15 10:07:51 +02:00
Robert Loehning
74d14d0092 QmlJs: Initialize members
Change-Id: I15a3ec660608266595a8b7a12b59016cc28331af
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-08-11 10:34:00 +00:00
Marco Benelli
73834060d7 QmlJs: fix false positives for properties
Resolve references while looking up for object members.

Task-number: QTCREATORBUG-18362
Change-Id: I9d2b2457fb3488c723a41e4e8ba1fc0ea9fe800f
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-08-10 08:08:38 +00:00
Orgad Shaneh
8430da3bf7 Merge remote-tracking branch 'origin/4.3' into master
Change-Id: I01ab8c85ea3372b6dce4142ddb9cf92d903ffca6
2017-05-23 23:41:40 +03:00
Thomas Hartmann
c515f68786 QmlJS: Allow Loaders in ui.qml files
Loader are working in the designer and we will add more support for
them in the future.

Change-Id: Ied62d65b0eb9933b44a7833ccafcb934d4ae6fba
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-05-22 14:19:02 +00:00
Tim Jenssen
19239e3770 QmlJs: use initilizer_lists for pairs
Change-Id: I0386d57ad3549814ab197c4e24549705e061c95a
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-04-27 07:45:06 +00:00
Eike Ziller
88897f3a87 Merge remote-tracking branch 'origin/4.3'
Conflicts:
	src/plugins/genericprojectmanager/genericproject.cpp
	src/plugins/genericprojectmanager/genericproject.h
	src/plugins/genericprojectmanager/genericprojectnodes.cpp
	src/plugins/genericprojectmanager/genericprojectnodes.h

Change-Id: Ie0c870f68c8d200a75489b75860987655b2f6175
2017-04-19 09:56:14 +02:00
Montel Laurent
5d27bc747b Use QFileInfo::exists(...) which is faster that QFileInfo(..).exists
Change-Id: I0d2e61d84c74e60ef4f54074a4ca00f2d0835562
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-04-14 13:18:28 +00:00
Thomas Hartmann
9089fbdfc5 QmlDesigner: Allow Dialog in .ui.qml files
The support is not perfect, but I see no reason to
excplitly not allow it.

Change-Id: I6b1d825acde156cc7b50160060e89bb964667ab8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-31 08:56:18 +00:00
Marco Benelli
61d30a20ce QmlJs: sync qmljs parser
The last version of the grammar contains some constructs that the code model
needs to know.

Task-number: QTCREATORBUG-17842
Change-Id: I6250f96431acc05b19f3fd1b6cc268a07485cf0f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-23 07:50:26 +00:00
Orgad Shaneh
da7cb91446 Merge remote-tracking branch 'origin/4.2' into 4.3
Change-Id: I4931dcc81be872d7712e67123e94d15ee696459f
2017-03-14 16:20:14 +02:00