Commit Graph

107 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
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
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
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
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
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
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
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
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
a6ae570c31 QmlJS: Move 'file not found' error message from Bind to Link.
Change-Id: I701fc179f377581b87e31630eaa4231688152f5e
Reviewed-on: http://codereview.qt.nokia.com/2813
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-08-10 09:23:28 +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
4285b48455 QmlJS: Dump builtins per Qt version.
Change-Id: I7b5179c4b33c24e83baf0536d158dd48d277637f
Reviewed-on: http://codereview.qt.nokia.com/1305
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-07-11 11:28:38 +02:00
Christian Kamm
59206106d3 QmlJS: Don't need to store imports per document in LinkPrivate.
Change-Id: I4bb9bcbc7a8e988760ca1b3463474b269e3802af
Reviewed-on: http://codereview.qt.nokia.com/1156
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-07-05 13:45:08 +02:00
Christian Kamm
9ea0380a4d QmlJS: Enforce Context always being linked.
The default way of creating a Context is through Link.

Change-Id: Ia81f7ce90ba2b33d02eed432a61be836d404bedd
Reviewed-on: http://codereview.qt.nokia.com/1041
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-07-05 11:52:09 +02:00
Christian Kamm
8b778b266b QmlJS: Rename Interpreter::Engine -> ValueOwner
Also move to a separate file.

Change-Id: I05910e8cf04a533b5d09a1c16e612e3b99b1d606
Reviewed-on: http://codereview.qt.nokia.com/1039
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-07-05 08:44:16 +02:00
Christian Kamm
8742026380 QmlJS: Allow for QML modules with version subdirectories.
That means
import Foo 2.1
can resolve to
/path/Foo.2.1 or
/path/Foo.2 or
/path/Foo

Task-number: QTCREATORBUG-4607
Change-Id: Ie1efc5be2ca2ed3ccc130e8a662f94aed11bec1a
Reviewed-on: http://codereview.qt.nokia.com/194
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-05-30 08:25:19 +02:00
Christian Kamm
96cde1e9de QmlJS: Fix import cache usage with 'as' imports.
Change-Id: I6c057e494f87df927adc7b83c6caf1ecc729ac65
Reviewed-on: http://codereview.qt.nokia.com/176
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-05-27 11:49:01 +02:00
Christian Kamm
a7f4e5fab5 QmlJS: Separate imported types and imported JS scopes.
Task-number: QTCREATORBUG-4981
Change-Id: I06d3e428ca4928296a3d5977aeff29fc3217c37c
Reviewed-on: http://codereview.qt.nokia.com/175
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-05-27 11:48:53 +02:00
Christian Kamm
d67b7d17dc QmlJS: Refactor ObjectValue members.
* property -> lookupMember
* setProperty -> setMember
* removeProperty -> removeMember

Change-Id: I638479ee2b90b684283e714630bdcab237f6b3f2
Done-with: Fawzi Mohamed
Reviewed-on: http://codereview.qt.nokia.com/77
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-05-24 11:55:03 +02:00
Christian Kamm
4937769eab QmlJS: Don't add invalid imports to TypeEnvironment.
Done-with: Fawzi Mohamed
2011-05-16 12:21:20 +02:00
Christian Kamm
cf15e14e5e QmlJS: Add tooltips to imports.
Task-number: QTCREATORBUG-4814
2011-05-12 15:29:41 +02:00
Christian Kamm
d0b12f8f19 QmlJS: Remove unused argument for Link helper function. 2011-05-11 09:13:13 +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
c504d28eb5 QmlJS: Add semantic errors to task window.
Task-number: QTCREATORBUG-4103
Reviewed-by: Leandro Melo
2011-04-21 11:16:50 +02:00
Christian Kamm
e21311132b QmlJS: Fix library-by-path imports.
Fixes the problem 5426c3ac2c and
7b25f438c6 worked around.

Reviewed-by: Erik Verbruggen
2011-04-21 11:16:14 +02:00
hjk
8397663964 Update license. 2011-04-13 11:49:28 +02:00
Kai Koehne
3e07024e10 QmlJS: Don't warn user about imports if static info is available
Don't underline the import if a qmldump fails,
but the typeinfo is available via a .qmltypes file. That should allow
users to 'fix' qmldump issues by shipping a .qmltypes file.

Reviewed-by: Erik Verbruggen
2011-04-12 11:27:17 +02:00
Erik Verbruggen
7b25f438c6 Fixed import of "." in a library with a hack.
Task-number: QTCREATORBUG-4198
Reviewed-by: Kai Koehne
2011-04-06 10:49:27 +02:00
Christian Kamm
5e78fef6c5 QmlDump: Fix uri-based plugin dumping. 2011-03-16 15:35:15 +01:00
Christian Kamm
b980a9b964 QmlJS: Fix implicit "." import when . has a QML module.
Reviewed-by: Erik Verbruggen
2011-03-10 15:03:36 +01:00
Christian Kamm
aeb8c352ee QmlJS: Try to implicitly import libraries in the same directory.
In QML, the current directory that holds a QML file is imported
implicitly. If it contains a qmldir file, the library is imported.

Since there is no explicit import statement, Creator can't know the URI
of this library. However, if type information is available for it
already - either through a previous dump or a qmltypes file - we can
guess the URI by looking at the contained exports.

Task-number: QTCREATORBUG-3768
2011-02-25 16:23:12 +01:00
Christian Kamm
4fc2032e10 QmlJS: Put types with cpp names into a separate package.
In preparation of relocatable plugin types.
2011-02-09 10:42:49 +01:00
Christian Kamm
c935fd36d7 qmldump: Use the new qmldump correctly. 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
Christian Kamm
283a3d32cd Qml/C++: Fix performance problem with type extraction.
By moving the offending code into a background thread.

Reviewed-by: Erik Verbruggen
2011-01-06 15:02:06 +01:00
Christian Kamm
0194da7300 Qml-C++: Find C++ qmlRegisterType calls and populate QML code model.
Reviewed-by: Erik Verbruggen
2011-01-04 15:58:22 +01:00
Christian Kamm
5de7be5f91 LanguageUtils: Add FakeMetaObject and ComponentVersion. 2011-01-04 15:58:21 +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
Christian Kamm
5dd92328fb QmlJS: Improve error reporting for failed plugin dumps.
Reviewed-by: Erik Verbruggen
2010-11-25 15:06:44 +01:00
Christian Kamm
3f505e9982 QmlJS: Add initial 'Find Usages' support. 2010-09-24 14:11:06 +02:00
Christian Kamm
13faf49322 QmlJS: Fix segfault during import resolution. 2010-09-24 13:28:01 +02:00
Christian Kamm
c7b3e3c81c QmlJS: Speed up Link significantly, provide more info on imports.
Link now caches imports. That means importing the same library (say, Qt)
from more than one file no longer creates an importing namespace for
each one. Instead, a single one is created for the instance of Link.

To make this work, the type environment in ScopeChain has been given its
own type: Interpreter::TypeEnvironment. That has the added benefit of
being able to carry meta-information about imports. You can use
TypeEnvironment::importInfo(qmlComponentName) to get information about
the import node that caused the import of the component.
2010-09-16 15:51:21 +02:00
Christian Kamm
8df6dd6d7d QmlJS: Add initial documentation for the base classes of the code model. 2010-09-15 15:26:34 +02:00
Roberto Raggi
ba03239749 Concate strings instead of using the QDir API to speed up the linking phase.
Reviewed-by: Christian Kamm
2010-09-08 15:13:12 +02:00
Christian Kamm
88601712c6 QmlJS: Make ScopeChain more const-correct.
We don't want people modifying the shared component chain on a
const Context *.
2010-08-30 14:12:06 +02:00
Christian Kamm
1a9c69ddb0 QmlJS: Fix crash when opening JS files.
Now that Contexts are cached, it needs to be copyable. However, the
ScopeChain has a QmlComponentChain member that owns resources and didn't
have a correct copy constructor or copy assignment operator.

I've made QmlComponentChain non-copyable and store a shared pointer to
an instance instead, as it will generally not change for a given
context.

Reviewed-by: Lasse Holmstedt
2010-08-27 09:42:07 +02:00