Commit Graph

104 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
0e54183d4d QmlJS: Remove Interpreter namespace.
The distinction between QmlJS and QmlJS::Interpreter has always been
weak and the extra namespace just added an unnecessary complication.

Change-Id: I4db8ef4bd91b5f6bf610a9d23fdbf55bd60250fc
Reviewed-on: http://codereview.qt.nokia.com/2743
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-08-08 13:21:28 +02:00
Christian Kamm
9dc9674c6b QmlJS: Share Context.
Previously Context was not entirely thread safe and had to be
copied locally. Now it is thread safe and its lifetime
managed by QSharedPointer.

The non-safe parts were moved into ScopeChain in a previous commit.

Change-Id: I851a93de85cbd6391dbea0fe33b011e2e093addb
Reviewed-on: http://codereview.qt.nokia.com/1695
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-08-08 12:05:19 +02:00
Christian Kamm
f87dc61986 QmlJS: Split Context and ScopeChain.
Context is created by Link and has information about imports
for all Documents in a Snapshot.

ScopeChain represents how lookup is done at a specific place in
a Document.

Change-Id: I874102d57bbaf1a497fa3f27633bed6ee75dcf10
Reviewed-on: http://codereview.qt.nokia.com/1694
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-08-08 12:05:03 +02:00
Christian Kamm
36ed6bce1d QmlJS: Move Context to its own file.
Change-Id: I91331b7039e27e2f57cc19b985c8ed86c955ec9e
Reviewed-on: http://codereview.qt.nokia.com/1042
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-07-05 11:52:20 +02:00
Christian Kamm
55b11db1f7 QmlJS: Fix error location for prototype errors.
Change-Id: Iaeb96ff67cfc92bcddeb1b7075b7fdcbaed317c0
Reviewed-on: http://codereview.qt.nokia.com/691
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-06-24 11:32:48 +02:00
Christian Kamm
33a130e222 QmlJS: Fix completion inside grouped propery bindings.
Task-number: QTCREATORBUG-3541
Change-Id: Ida8e59b65836c8515fbfbd2a9e4737d9ae04e76c
Reviewed-on: http://codereview.qt.nokia.com/639
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-06-23 11:47:07 +02:00
Fawzi Mohamed
fe564852ad Qmljs: added scope for blocks in UiScriptBindings and UiPublicMember
correctly insert the scope for code blocks in UiScriptBindings and
UiPublicMember, and improve find usages for types (correctly detecting
variables in the same scope)

Change-Id: Iaaf1a59f041f3831fbe04243b220fb85fde76479
Reviewed-on: http://codereview.qt.nokia.com/335
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-06-07 13:04:21 +02:00
Christian Kamm
0bf18d008b QmlJS: Find prototype resolution errors.
To avoid lots of follow-up errors where the root cause is a failed
prototype resolution or a prototype cycle.

Task-number: QTCREATORBUG-4952
Change-Id: Id474c8c6c152c993aca8c6c421b6d88eb1481676
Reviewed-on: http://codereview.qt.nokia.com/36
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2011-05-20 13:33:18 +02:00
Christian Kamm
d72bddc7da QmlJS: Update to new QmlJS parser.
UiPublicMember is now initialized with a statement.
2011-05-12 13:39:53 +02:00
Tobias Hunger
aa2acec14c Fix/add copyright headers
Change-Id: I8b73d583be1ee7183f4074bce49d5390e38631a2
2011-05-06 15:17:05 +02:00
Christian Kamm
d05992d0fa QmlJS: Stop doing significant work in constructors.
To avoid order-of-initialization problems.

Reviewed-by: Thomas Hartmann
2011-05-06 13:48:55 +02:00
Christian Kamm
02b7eacf4b QmlJS: Fix type detection for alias properties.
Task-number: QTCREATORBUG-2306
2011-05-04 11:14:35 +02:00
Christian Kamm
ad43f5c48e QmlJS: Don't warn about function exp statements.
Reviewed-by: Roberto Raggi
2011-04-21 09:43:51 +02:00
hjk
8397663964 Update license. 2011-04-13 11:49:28 +02:00
Thomas Hartmann
1178d623d5 QmlJs::Check: using the Option enum to ignore type errors
Unifying the api and exposing the options.
2011-03-01 17:21:03 +01:00
Thomas Hartmann
d6e08c3542 QmlJs::Check: turning "file or directory does not exist" into a warning
Missing files should be a warning.
2011-03-01 17:21:02 +01:00
Christian Kamm
1d4cd9b7f2 QmlJS: Remove the strict separation of types and attached types.
The problem was that several lookup calls suddenly failed because
the actual QML types were no longer in the default scope chain. However,
the QML documentation says the type names are in the scope.

Also, 'MyComponent.' in a JS-expression context only showed the attached
properties of MyComponent and missed the enums.

With this change completion now may offers too many options, but that's
better than missing some.

This reverts parts of 490f2797f6

Reviewed-by: Leandro Melo
2011-02-21 15:05:04 +01:00
Christian Kamm
490f2797f6 QmlJS: Completion for attached properties. 2011-02-10 17:04:22 +01:00
Christian Kamm
c99d2ca206 QmlJS: Fix local-file url property check. 2011-02-09 10:42:49 +01:00
con
d1023c7614 It's 2011 now.
Reviewed-by: hjk
2011-01-12 09:46:24 +01:00
con
b1bcf081d8 Merge branch '2.1'
Conflicts:
	src/plugins/coreplugin/basemode.cpp
	src/plugins/coreplugin/basemode.h
	src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp
	src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h
	src/plugins/debugger/cdb/cdbsymbolpathlisteditor.cpp
	src/plugins/debugger/debuggeragents.cpp
	src/plugins/debugger/debuggeruiswitcher.cpp
	src/plugins/debugger/debuggeruiswitcher.h
	src/plugins/projectexplorer/buildconfigdialog.cpp
	src/plugins/qmldesigner/components/propertyeditor/colorwidget.cpp
	src/plugins/qmldesigner/components/propertyeditor/colorwidget.h
	src/plugins/qmldesigner/designercore/include/enumeratormetainfo.h
	src/plugins/qmldesigner/designercore/include/modelutilities.h
	src/plugins/qmldesigner/designercore/include/nodeinstance.h
	src/plugins/qmldesigner/designercore/include/propertymetainfo.h
	src/plugins/qmldesigner/designercore/instances/graphicsscenenodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/graphicsscenenodeinstance.h
	src/plugins/qmldesigner/designercore/instances/graphicsviewnodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/graphicswidgetnodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/graphicswidgetnodeinstance.h
	src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/qmlviewnodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/widgetnodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/widgetnodeinstance.h
	src/plugins/qmldesigner/designercore/metainfo/enumeratormetainfo.cpp
	src/plugins/qmldesigner/designercore/metainfo/propertymetainfo.cpp
	src/plugins/qmldesigner/designercore/model/modelutilities.cpp
	src/plugins/snippets/inputwidget.cpp
	src/plugins/snippets/snippetscompletion.cpp
	src/plugins/snippets/snippetscompletion.h
	src/plugins/snippets/snippetspec.cpp
	src/plugins/snippets/snippetsplugin.cpp
	src/plugins/snippets/snippetswindow.cpp
	src/plugins/snippets/snippetswindow.h
	src/plugins/texteditor/snippetsparser.cpp
	src/tools/qml/qmldom/main.cpp
	tests/manual/trk/runner.cpp
	tests/manual/trk/trkolddevice.cpp
	tests/manual/trk/trkolddevice.h
	tests/manual/trk/trkserver.cpp
2010-12-17 17:00:53 +01:00
con
04e32b0049 License headers. 2010-12-17 16:03:42 +01:00
Thomas Hartmann
8e5eaf821f QMlJSCheck: Components have their own scope for ids
Each Components starts a new scope for ids. Using a stack to check
this properly.
2010-12-13 17:51:37 +01:00
Thomas Hartmann
4d66396c36 QmlJsCheck: check for Behaivours and exclude them from duplicate check 2010-12-13 15:08:32 +01:00
Thomas Hartmann
0eb18f850e QmlJSCheck: adding more checks
We are checking for duplicate ids and duplicate property definitions now.
2010-12-07 17:33:51 +01:00
Christian Kamm
8b339f921f JS checks: Check code block script bindings for common errors.
Reviewed-by: Erik Verbruggen
2010-12-06 10:58:58 +01:00
Christian Kamm
23d7752815 JS checks: Allow blocks after for(var ...).
Also
* check the condition of the 'for(var' statement for assignment
* allow comma expressions in 'for(var'

Reviewed-by: Erik Verbruggen
2010-12-06 10:58:58 +01:00
Christian Kamm
847e5dfb61 QmlJS: Don't warn about expression statements in script bindings.
Reviewed-by: Roberto Raggi
2010-11-29 12:21:02 +01:00
Christian Kamm
5355c8ef4c QmlJS: Don't warn for "string == ''" and "boolean == true".
Reviewed-by: Roberto Raggi
2010-11-29 11:52:30 +01:00
Christian Kamm
042ee8de01 QmlJS: Don't warn on 'numbervalue == 0'.
Reviewed-by: Roberto Raggi
2010-11-29 11:20:45 +01:00
Christian Kamm
055aa15fcc QmlJS: Remove overzealous 'undefined' check for enums.
The "value might be 'undefined'" warning triggered whenever the static
expression evaluator failed to produce a value. At the moment, it does
so for almost all non-trivial expressions.

The warning is now disabled.

Task-number: QTCREATORBUG-3208
2010-11-29 09:01:40 +01:00
Christian Kamm
f40b3c22f4 QmlJS: Add JSLint-style warnings for common JS traps.
Task-number: QTCREATORBUG-3071
Reviewed-by: Erik Verbruggen
2010-11-25 15:06:45 +01:00
Christian Kamm
124358d258 QmlJS: Enhance check pass to do lookup... and disable it.
It still generates too many false-negatives for now. Will be enabled
once the remaining lookup failures have been fixed.

Reviewed-by: Erik Verbruggen
2010-11-25 15:06:45 +01:00