Commit Graph

789 Commits

Author SHA1 Message Date
Christian Kamm
90925c69f6 QmlJS: Rename QmlObjectValue -> CppComponentValue.
Reviewed-by: Fawzi Mohamed
Reviewed-by: Thomas Hartmann
Change-Id: Ib89388d5a5678403e4637eec5829f3520637ee27
Reviewed-on: http://codereview.qt-project.org/6310
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
Sanity-Review: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-12 10:52:56 +02:00
Christian Kamm
010ce2d20d QmlJS: Set correct scope in signal handlers.
This means the code model will now offer correct completion and
highlighting for arguments of signals in their handlers, example:

MouseArea {
  onClicked: {
    mou<complete> // now also completes 'mouse'
  }
}

Reviewed-by: Fawzi Mohamed
Change-Id: I01838ef00e391b13e6e5a832c9ec3cd983689c5b
Reviewed-on: http://codereview.qt-project.org/6147
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
Sanity-Review: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-12 10:29:27 +02:00
Christian Kamm
e0f24bb545 QmlJS: Fix the fix for scope chain rebuilds.
Change-Id: Idf18d44e647a2019405199bcc5273afb03816af1
Reviewed-on: http://codereview.qt-project.org/6498
Sanity-Review: Christian Kamm <christian.d.kamm@nokia.com>
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-12 08:54:24 +02:00
Christian Kamm
03689eeb50 QmlJS checks: Allow calling some builtin constructors as functions.
String, Boolean, Number and Object perform type conversion. Date returns
the current date.

Change-Id: I51e5bcbb0fa85ceb30b3ee3749f96c3e3b12ca21
Reviewed-on: http://codereview.qt-project.org/6043
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-10-12 08:50:26 +02:00
Christian Kamm
d48566234f QmlJS checks: Hint about extra parentheses.
Migrated from QtChecker.

Change-Id: I85f7dd039ac858b103dfe0af257f66031540c5de
Reviewed-on: http://codereview.qt-project.org/5969
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-10-12 08:49:41 +02:00
Christian Kamm
038111c384 QmlJS checks: Disable some checks when imports failed.
The important error in this case is on the import.

Change-Id: I3a547ca7ac44a89aba6819ea80ec52185071408a
Reviewed-on: http://codereview.qt-project.org/5879
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
Sanity-Review: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-12 08:49:30 +02:00
Christian Kamm
f74d3fbb06 QmlJS: Allow for 'ModuleApi' elements in qmltypes files.
But ignore them for now. Reading them is a new feature that will
be introduced in master.

Change-Id: Id362caab2e3b48e198d87f59a0a7d99d24267378
Reviewed-on: http://codereview.qt-project.org/6431
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-10-12 08:42:58 +02:00
Christian Kamm
1a06d4f55c QmlJS: Fix scope builder rebuilds.
Change-Id: If5e585b074dd1885c3b591b5d2b7c89d50078c58
Reviewed-on: http://codereview.qt-project.org/6497
Sanity-Review: Christian Kamm <christian.d.kamm@nokia.com>
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-12 08:42:38 +02:00
Christian Kamm
bf3bf658c4 QmlJS checks: Add hint about not using multiple statements per line.
Migrated from QtChecker.

Change-Id: Ia76067a5f0e443a61a7b78ca9081f5a1bb51b471
Reviewed-on: http://codereview.qt-project.org/5861
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-10-10 14:40:17 +02:00
Christian Kamm
1b0dc76564 QmlJS checks: Add warning about 'eval'.
Migrated from QtChecker.

Change-Id: I4b3e8993c7b9f697497d2199b24bf49379dbc1b4
Reviewed-on: http://codereview.qt-project.org/5860
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-10-10 14:40:10 +02:00
Christian Kamm
be9d25ec64 QmlJS checks: Warn when using some builtin constructors.
Number, String, Array, Object, Function and Boolean should not
be used.

Migrated from QtChecker.

Change-Id: I8aee41f12389196ed49c44e26eb04d3fac040a2b
Reviewed-on: http://codereview.qt-project.org/5859
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-10-10 14:40:03 +02:00
Christian Kamm
c82d53d4ae QmlJS checks: Add confusing +/- check.
Migrated from QtChecker.

Change-Id: I06115152f979f9abfa9cbdf4a3e2e63a51ea7284
Reviewed-on: http://codereview.qt-project.org/5858
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
2011-10-10 14:39:56 +02:00
Christian Kamm
aeadbcae40 QmlJS checks: Add check for spacing around binary operators.
Adapted from QtChecker.

Change-Id: I434582314e6431c56c9628a5a642bbfb032dfc2f
Reviewed-on: http://codereview.qt-project.org/5857
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
2011-10-10 14:39:49 +02:00
Christian Kamm
da123becaf QmlJS checks: Add Hint about anonymous function formatting.
Migrated from QtChecker.

Change-Id: I0178cc189d1c98b51e1aeb43db7421ba8c43fc7e
Reviewed-on: http://codereview.qt-project.org/5856
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
2011-10-10 14:39:39 +02:00
Christian Kamm
55713a1514 QmlJS checks: Add severity and unique id to messages.
Change-Id: I2cded26524c3f64152107e65d740658e3003ffac
Reviewed-on: http://codereview.qt-project.org/5790
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-10-10 14:39:20 +02:00
Christian Kamm
a7f78991c9 QmlJS: Move commonly used functions to qmlutils.h.
Change-Id: I22376d96fe575bc00a55094c06af80e32a5587e6
Reviewed-on: http://codereview.qt-project.org/6238
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-10-10 09:36:12 +02:00
Christian Kamm
909c61247c QmlJS: Allow 'var' property type.
It's new in Qt 5.

Change-Id: If3e670d42528ca6996ae280d96077ce744d281d9
Reviewed-on: http://codereview.qt-project.org/6121
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-10-06 10:58:29 +02:00
Christian Kamm
8faafc2f0c QmlJS: Fix saving and restoring QML scope objects.
Change-Id: I621d7c3dbc8d5613b5d9ffddd08acd582559990b
Reviewed-on: http://codereview.qt-project.org/5720
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-28 15:29:05 +02:00
Christian Kamm
82cbd0a974 QmlJS: Support .import directives in js files.
* Allow .import...
* Fix parsing of JS files when using Lexer::scanDirectives()
* Clean up ImportInfo construction.
* Rename ImportInfo::id to ImportInfo::as.

Change-Id: I888da248f06dc6184db99aa74c3b50d7f2f5e491
Reviewed-on: http://codereview.qt-project.org/5625
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-28 08:52:56 +02:00
Christian Kamm
3bd56fe9f1 QmlJS: Fix crash.
Change-Id: Ieacc7896eaeb478c6bd79a0865280f0cb595101e
Reviewed-on: http://codereview.qt-project.org/5619
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-27 13:52:06 +02:00
Christian Kamm
290a32501c QmlJS: Fix typo in building string uris.
Change-Id: I94421816f4bd30591925be42d7d386fac589e832
Reviewed-on: http://codereview.qt-project.org/5595
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-09-27 09:32:16 +02:00
Christian Kamm
c7d8462bf8 QmlJS: Fix threading issue in QmlObjectValue.
Still need to get rid of the lock in ValueOwner::registerValue.

Change-Id: If9bbc548de54edf52805906aaaf730f5c66573dd
Reviewed-on: http://codereview.qt-project.org/5542
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-27 08:30:28 +02:00
Christian Kamm
fdd0a15ef4 QmlJS: Separate metaObjectRevision from minor version number.
They need not to be identical. Additionally:
* Rename ImportInfo::name to path, because that's what it does.
* Add ImportInfo::name, for getting the uri with the names
  separated by dots.
* Allow for exportMetaObjectRevisions in qmltypes files.
* Allow for exports with an empty type name, as generated by
  qmlRegisterRevision. They are used for associating meta object
  revisions with non-exported types.
* Rewrite the Qt 4.7 import to QtQuick 1.0 at an early stage. In
  preparation for the Qt 5 type information update, where Qt 4.7
  is gone.

Change-Id: Ia287193623d9530a56b9eb8d2481d50aabd94c3e
Reviewed-on: http://codereview.qt-project.org/5309
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-26 12:04:16 +02:00
Christian Kamm
3a110439e9 QmlJS: Only try qmldump on Desktop and Simulator Qt.
In particular, don't complain about a missing qmldump binary on other
platforms.

Change-Id: Ie2e96bcb67e609aa5aed31510b06139d2d9ce77e
Reviewed-on: http://codereview.qt-project.org/5327
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-21 16:03:41 +02:00
Christian Kamm
98f44af8a2 QmlJS: Lexer apply fix from Qt5.
Change-Id: Ic11e6bad2868f56b5d7c2c063b72fb3d25c5417f
Reviewed-on: http://codereview.qt-project.org/5294
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-21 10:30:58 +02:00
Christian Kamm
a225f7a0af QmlJS checks: Add tests and fix small bugs for 'unreachable'.
Change-Id: Iaf9febc841130fa913fcc071ed0bf28ff9e0b63b
Reviewed-on: http://codereview.qt-project.org/5149
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-20 13:21:03 +02:00
Kai Koehne
084f116e7c QmlJS: Remove qmlutils_p.h also from .pri file
File got removed in 25f37732b0

Change-Id: Ia0acd2ddab76768ce960278bedf395b13f3d2512
Reviewed-on: http://codereview.qt-project.org/5207
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-09-20 10:03:55 +02:00
Christian Kamm
0df9c1fa1b QmlJS: Use new Lexer::scanDirectives.
Change-Id: Id9f4cd6a53dc0d3f4cf0a0b3c846eca0e48372fc
Reviewed-on: http://codereview.qt-project.org/5144
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-19 14:18:30 +02:00
Christian Kamm
25f37732b0 QmlJS: Update parser from Qt5.
Change-Id: I26a5fb6a1eb99a777e4f1e01fb7b19e559c9bce7
Reviewed-on: http://codereview.qt-project.org/5143
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-19 14:18:23 +02:00
Christian Kamm
4fdeeb3039 QmlJS: Fix enum completion with 'as' imports.
Change-Id: Ifc229c23c14a6395c9d3e5f7ec76b9b04678787d
Reviewed-on: http://codereview.qt-project.org/5134
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-19 13:52:44 +02:00
Christian Kamm
6c925cf0fc QmlJS: Rework exported C++ type registry.
The problem was that if you exported
A 1.0, A 1.1 and B 1.0 where A is the prototype of B
the code model had not enough information to know that, depending
on the import, B 1.0's prototype should be A 1.1 or A 1.0.

To solve this problem QmlObjectValues now store the import's version
as well as the local component version. In the example above B 1.0
would have import version 1.1 if the 1.1 module was imported and thus
be able to choose the right prototype.

Change-Id: I7ef33f12ca5a528c62b2a8240f4b5720b0ebd4c3
Reviewed-on: http://codereview.qt-project.org/5129
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-19 13:52:26 +02:00
hjk
5295e05310 minor style
Change-Id: Id21e8a3962550a1c66d761e718b48a8fcf4053e7
Reviewed-on: http://codereview.qt-project.org/5122
Reviewed-by: hjk <qthjk@ovi.com>
2011-09-19 11:24:14 +02:00
Christian Kamm
f8462cca65 QmlJS: Change from QMap to QHash for QString keys.
Tests indicate that lookup in QHash<QString, ...> is more performant
even for short strings.

Change-Id: I8e5a73d0f1a72e202522f397b16901887f9c3591
Reviewed-on: http://codereview.qt-project.org/5070
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-19 09:09:28 +02:00
hjk
58cb19e55e all: less QScopedPointer
Change-Id: I536bdb4d4f0c10fa858560f3c160fc0fff8da9b2
Reviewed-on: http://codereview.qt-project.org/5116
Reviewed-by: hjk <qthjk@ovi.com>
2011-09-19 08:56:44 +02:00
Christian Kamm
b3bb5d700e QmlJS checks: Don't crash if try has no catch or finally.
Change-Id: If7001963bc11f2fa01f058c903ee014f6acb0c04
Reviewed-on: http://codereview.qt-project.org/5102
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-16 15:35:07 +02:00
Christian Kamm
4083880073 QmlJS: When completing enums, add Item.Foo instead of "Foo".
Change-Id: I9a74bd726d9691ca93477916159a80c04c35f52d
Reviewed-on: http://codereview.qt-project.org/4987
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-15 13:49:13 +02:00
Christian Kamm
5b1a24ab95 QmlJS: Improve completion of signals.
* Change from Reference to FunctionValue: There was no reason for them
  being References as the argument types never need lookup.
* Enumerate in global completion: When you define 'signal foo(int a)'
  you now get completion for 'foo' and will get the function argument
  hint popup.

Change-Id: Ic348db477a34ba468dfdb690499a9cd8fd605cd2
Reviewed-on: http://codereview.qt-project.org/4774
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-14 13:00:29 +02:00
Christian Kamm
a8b03e9c28 QmlJS: Simplify check if a document instantiates a component.
Change-Id: If45002ecec56ca766ef7a0c7878c0a48fadee452
Reviewed-on: http://codereview.qt-project.org/4734
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-14 11:48:41 +02:00
Christian Kamm
4b2f42cf87 QmlJS: Adjust existing code for updated QML parser.
Change-Id: I153723eeb9973be025daf47e317f7b9d076a3c72
Reviewed-on: http://codereview.qt-project.org/4733
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-14 11:48:22 +02:00
Christian Kamm
b531209002 QmlJS: Merge parser updates from Qt5.
Change-Id: Ibed38abca8f7e7bae7d424751a18c83f4c9e9bc5
Reviewed-on: http://codereview.qt-project.org/4732
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-14 11:48:11 +02:00
Christian Kamm
367e27cde7 QmlJS checks: Correct the check for dangerous == and add tests.
Change-Id: Ie0f4062069bf241020868af34ce6d36146b4b0c7
Reviewed-on: http://codereview.qt-project.org/4646
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-14 11:13:59 +02:00
Christian Kamm
9f3a5c7370 QmlJS: Cleanup Link.
* Don't use Qt macros for d-ptr.
* Move private functions to LinkPrivate.

Change-Id: Icb6f579e9168dd9bf5cccec1255fda1939e47c9a
Reviewed-on: http://codereview.qt-project.org/4767
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-14 11:13:31 +02:00
Christian Kamm
ece400cfb6 QmlJS: Enable 'follow symbol' for local variables.
Task-number: QTCREATORBUG-6094
Change-Id: Icf286bc412b48dbd1cb38c47ad7b91040b5aae0f
Reviewed-on: http://codereview.qt-project.org/4864
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-14 11:13:21 +02:00
Christian Kamm
43a6a6d58c QmlJS: Improve import error messages.
Change-Id: Ief305b787fbc4577acfdec41083bc72e178db46d
Reviewed-on: http://codereview.qt-project.org/4537
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-14 11:03:16 +02:00
Christian Kamm
16b4a6fe73 QmlJS indenter: Fix labelled statements and break/continue with label.
Also do some cleanup to make handling of substatements nicer.

Change-Id: I78773fc81d9b0058fa97c5cef393cca34b7fd885
Reviewed-on: http://codereview.qt-project.org/4413
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-14 11:02:45 +02:00
Christian Kamm
6808607c3b QmlJS checks: Add 'unreachable code' warnings.
Change-Id: I59e490adce5c0cd7784894a0f9d4435cdcbc9b23
Reviewed-on: http://codereview.qt-project.org/4332
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-14 10:56:51 +02:00
Christian Kamm
7b2110de7e QmlJS: Fix reference lookup cycles.
Since several reference lookups involve Evaluate which may cause
further reference lookups, we need to be able to pass the existing
ReferenceContext to avoid cycles.

Change-Id: I2f1eeaad4d6b6ff094413d51077b03c985f6fab4
Reviewed-on: http://codereview.qt-project.org/4653
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-12 14:47:35 +02:00
Christian Kamm
903c6b60cd QmlJS: Use mime types to distinguish qml and js files.
This allows adding patterns to the qml mime type in the options dialog.
Previously they were always parsed as js.

Change-Id: Ifa344fb6ab8cbcda02becef991cf6807615a1caa
Reviewed-on: http://codereview.qt-project.org/4515
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-12 10:45:53 +02:00
hjk
bfd9fcbb3c all: some m_d -> d style
Change-Id: Iac1f12980bf47666007817cfb2c64a6d1e9b780e
Reviewed-on: http://codereview.qt-project.org/4477
Reviewed-by: hjk <qthjk@ovi.com>
2011-09-08 17:42:14 +02:00
Christian Kamm
ca35046827 QmlJS checks: Improve warning about accidental empty blocks.
Change-Id: I2bddd65aef9092bf87f5a441e065ebca0e772174
Reviewed-on: http://codereview.qt-project.org/4331
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-08 14:06:28 +02:00