Commit Graph

574 Commits

Author SHA1 Message Date
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
Christian Kamm
5b8d7b465c QmlJS checks: Fix collection of use-before-declaration warnings.
Previously they would not be collected if the var had a
duplicate-declaration warning.

Change-Id: I82244e911fcdfc3d11cc391288da263ee288a3ca
Reviewed-on: http://codereview.qt-project.org/4330
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-08 14:06:16 +02:00
Christian Kamm
62a71b75a0 QmlJS indenter: Fix indentation for property initializers.
property int foo: {

used to start an object literal but is a block statement now.

Change-Id: I9ffbce4927b444314f1a43aba65ca3d9d234e47c
Reviewed-on: http://codereview.qt-project.org/4339
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-08 13:55:08 +02:00
Christian Kamm
bfc95befa8 QmlJS: Honor typeinfo lines in qmldir files.
Change-Id: I1ddad1eb031bc4b95671be4a474b5e8e72f6e350
Reviewed-on: http://codereview.qt-project.org/4137
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-08 12:34:32 +02:00
Christian Kamm
10a956a8f7 QmlJS: Find setContextProperty calls in C++ and expose to QML.
Task-number: QTCREATORBUG-3199

Change-Id: I591490ceafadc0f5a07c63ec063f1bdfa7055f47
Reviewed-on: http://codereview.qt-project.org/4074
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-08 12:34:22 +02:00
Christian Kamm
daf6f5fff0 QmlJS checks: Don't complain about alias properties.
Change-Id: I6721b42a6ae8cc4de3d85754bf12c95f7366212e
Reviewed-on: http://codereview.qt-project.org/4395
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-09-08 08:56:01 +02:00
Christian Kamm
b53570d48d QmlJS parser: Fix else token in IfStatement.
Change-Id: Id994a9c5777021e3dc5027776df42234441440d8
Reviewed-on: http://codereview.qt.nokia.com/4319
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-07 09:32:32 +02:00
Christian Kamm
e850586b77 QmlJS checks: Warn about inappropriate use of constructor functions.
Change-Id: Iaedaaa88915f2010bfdd0d2b5ca95f01f8663ed7
Reviewed-on: http://codereview.qt.nokia.com/4254
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-07 07:27:57 +02:00
Christian Kamm
4e60db9065 QmlJS: Cleanup in Check.
Evaluate supports ExpressionStatements now.

Change-Id: I74c440fe0abf27c3d3b41b7d28a69fdd9359fb2e
Reviewed-on: http://codereview.qt.nokia.com/4080
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-09-07 07:27:45 +02:00
Christian Kamm
aad5ab8542 QmlJS: Check property declaration types.
Change-Id: I2cc1236552e00e99a846b0d4b724135724f175fc
Task-number: QTCREATORBUG-3666
Reviewed-on: http://codereview.qt.nokia.com/4241
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-06 10:07:16 +02:00
Christian Kamm
312d43f215 QmlJS: Fix lookup for enums.
* Also look for enums in prototypes.
* Report back which QmlObjectValue had the enum.
* Fix a bug where enum lookup was always skipped.

Change-Id: I9c9fd8f8cf9bd8cc5f1bb5688fef5786267cd794
Reviewed-on: http://codereview.qt.nokia.com/4192
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-09-05 14:56:37 +02:00
Christian Kamm
650b280b30 QmlJS: Ensure project infos are removed when a project closes.
As a side effect, this removes parse errors of QML files that are no
longer in any project from the "Build Issues" list.

Change-Id: I7aef8850a207ac060648dc92e2dd759108b71731
Reviewed-on: http://codereview.qt.nokia.com/3668
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-08-30 12:00:44 +02:00
Christian Kamm
9c1cb774a1 QmlJS: Improve ModelManagerInterface API, add docs.
Change-Id: Ic65d767cbad85de89dffaac66d9e80d8d467f04a
Reviewed-on: http://codereview.qt.nokia.com/3851
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-08-30 10:17:32 +02:00
Christian Kamm
27d0830698 QmlJS: Move the exported-C++-type detection out of C++ code.
It now lives in qmljstools/qmljsfindexportedcpptypes, all in one place.

Also ensures that the source code is available when a file is being
scanned for QML exports. This will enable checking comments for
annotations about the URI a plugin is usually imported as.

Change-Id: I1da36d0678e0a8d34b171dbe0f6b5690d89eb18b
Reviewed-on: http://codereview.qt.nokia.com/3392
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-08-24 12:13:41 +02:00
Christian Kamm
c105ae47c1 QmlJS: Add semantic highlighting.
Change-Id: If9293244075cff1a52801b50cdbb77248ecd21ea
Reviewed-on: http://codereview.qt.nokia.com/3310
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-08-24 11:30:20 +02:00
Christian Kamm
f725c24c56 QmlJS: Fix semantic and non-semantic QML error reporting.
The QML snapshot only ever contains valid Documents; to compile a list
of parser problems we need to get at the invalid documents.

To do that, the model manager now provides a Snapshot with up to date,
but potentially invalid documents. That should also be useful for other
things.

Change-Id: I67892f63771c221bf2fe2c2bf0240a0f4e523227
Reviewed-on: http://codereview.qt.nokia.com/3012
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-08-18 17:11:59 +02:00