aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler
Commit message (Collapse)AuthorAgeFilesLines
...
* QmlCompiler: Properly discern between inherited and own namesUlf Hermann2020-10-226-50/+64
| | | | | | | | | | | Previously, we would mix them up on importExportedNames(), which was also misnamed. Now we keep them in their proper place in the scope hierarchy, so that we can identify which scope a property came from. Exceptions are the qmllint-specific treatment of parent properties and Connections elements. Change-Id: I7c012388b16c83439d6f2de2e83fac0da4940d30 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Make sure any import depends on the builtinsUlf Hermann2020-10-222-10/+18
| | | | | | | Otherwise types like "int" are not resolved. Change-Id: I35d0eb05e955822b082d2f6067d1e5b40c510cf1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Use size_t for qHashUlf Hermann2020-10-221-2/+2
| | | | | | | | It is expected to return an unsigned value. Change-Id: Id75c0887de7e9b0eeab378041598621c89507501 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qmllint: Resolve aliases in nested objectsUlf Hermann2020-10-222-21/+30
| | | | | | | So far we've just ignored them. Change-Id: I2ca522ef825a341a3f4bf1c2a42fb0376180cdda Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlcachegen: Move resourcefilter.cpp into QmlCompilerUlf Hermann2020-10-204-2/+237
| | | | | | | | For backwards compatibility, a replacement for qmlcachegen will need to provide the same functionality. Change-Id: I22664230ea636d384190122223d15819ebee930c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlJSImporter: Expose the imported objectsUlf Hermann2020-10-201-0/+1
| | | | | Change-Id: I1257d4efe1813d2b95a37d95a82c21c30fc15591 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlJSImporter: Pass the source location to the resultUlf Hermann2020-10-201-0/+1
| | | | | Change-Id: I8c52efc752fbeae4485d7cc2112d615707e2afd1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Cache builtin typesUlf Hermann2020-10-202-1/+6
| | | | | | | | If we import the builtin types multiple times from different places, we want them to match. Change-Id: I3f2f0ec0d72fb4e178ee69517ecafa8260ebc35e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Drop the metaobject revision from exportsUlf Hermann2020-10-193-22/+18
| | | | | | | | | Instead, output a warning if the revision doesn't match the version. We want to get rid of generic version/revision matching. To this end, add a way to retrieve the version from an export. Change-Id: Ie887103eba910f14e49faa684ac559cc72cab199 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Add hasMethod() and hasProperty() to QQmlJSScopeUlf Hermann2020-10-191-0/+2
| | | | | | Change-Id: I29e38054a5adcf398f63df7f367ed4bc24c09c75 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Read the "bindable" attribute from plugins.qmltypesUlf Hermann2020-10-163-43/+44
| | | | | | | | | And refactor QQmlJSMetaProperty to use setters rather than a gigantic constructor. Also, notice that we don't have to construct the same property twice just to update its type. Change-Id: Ia6c195fa7088f6ecdff868daae17d4284c1edb22 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Retrieve warnings from qmltypes parserUlf Hermann2020-10-161-0/+4
| | | | | Change-Id: I83292c9db42e39e52fbf20e92c036d789bbdb2d6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlJSScope: Add a way to retrieve a single method or propertyUlf Hermann2020-10-162-5/+8
| | | | | Change-Id: Icf8f2aae869176ed864dcdd3b4231e71043cb0bc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: add operator!= to QDeferredPointerUlf Hermann2020-10-151-0/+10
| | | | | Change-Id: I2191660b731d85495d0e90152e0fe493553b7a2f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Pass source location to all scopes from QML filesUlf Hermann2020-10-152-20/+32
| | | | | Change-Id: Ic0aeb152acb0d90d15cc48a55c0ad5b15a60a6eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Further unify findwarnings.cpp and qqmljsimportvisitor.cppUlf Hermann2020-10-152-4/+201
| | | | | | | | Most of the logic in findwarnings.cpp applies also to imported files and should live in the base class. Change-Id: I65f326f50a8bfab0dff4b5b31f7bee7300b20704 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QDeferredPointer: Remove the factory before executing itUlf Hermann2020-10-152-10/+9
| | | | | | | Only this way we avoid infinite recursion on cyclic references. Change-Id: I4d6323a093d17f7d55965dc40f9dc5f1a647df9c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Unify QQmlJSImportVisitor and FindWarningsVisitorUlf Hermann2020-10-155-106/+199
| | | | | | | | | They are both pretty much doing the same thing, except that the import visitor is not as thorough. We need the full analysis in QtQmlCompiler, so we successively move the code over. Change-Id: If7fb47f88165fd8b61f4ccc408ccfbb7dad533e6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Defer resolution of types read from QML filesUlf Hermann2020-10-158-26/+253
| | | | | | | | | | When importing a directory we most likely don't need all of the files in the directory. Therefore we now parse them only when they are accessed. This speeds up the execution and will allow us to process imports recursively without running into infinite recursion. Change-Id: I0c79313de792249e6bb86144b5014a7787dbdc5b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Unify the printing of diagnosticsUlf Hermann2020-10-155-27/+53
| | | | | | | | We can use QQmlJS::DiagnosticMessage to carry message, type, and location. Change-Id: I3868bc8035b4da13efad0d1b7d2f8dfeff1ef234 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Rename QQmlJSImportedMembersVisitorUlf Hermann2020-10-125-15/+15
| | | | | | | We need to make this a general import visitor. Change-Id: I735378fc9139cb4891f8b113d86395df856fb4e9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow optional imports in qmldir filesUlf Hermann2020-10-081-4/+6
| | | | | | | | | | This is useful for modules that select their imports at runtime using qmlRegisterModuleImport(). We can list all possible variants as optional imports so that tools can see what types might be available. Task-number: QTBUG-87130 Change-Id: I8a37bdde79aef3619fd1f05e5ea6781d521afa88 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Support 5.x style composite types in qmltypes filesUlf Hermann2020-10-071-1/+1
| | | | | | | | | In Qt6 we don't want those anymore, but it's easy enough to support them for now. Task-number: QTBUG-87164 Change-Id: I2a6cd1dd99f772d132f71575c9c5f4538a3dd0f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Read deprecated dependency specifications from qmltypes filesUlf Hermann2020-10-072-8/+42
| | | | | | | | And produce a warning when doing so. Task-number: QTBUG-87164 Change-Id: I75eab97a37af1268a310e88e3ac6a625127a7f62 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Use the declared typeinfos rather than the defaultUlf Hermann2020-10-071-2/+15
| | | | | | | | | | ... and produce a warning when encountering the default. This shows us that the qmake build omits some typeinfo entries from common modules. Add those. Change-Id: I1c7e87e8a54ef24a6076090e6051eb1c03c09b2a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-061-1/+1
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* QmlCompiler: Unify and optimize directory importsUlf Hermann2020-10-061-15/+8
| | | | | | | | We don't need to import lowercase files as those can't be used anyway. Also, the code was duplicated. Change-Id: I5f24977e59a9b244b70362045524ed1e7849eeb8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Split importFileOrDirectory() in twoUlf Hermann2020-10-062-14/+12
| | | | | | | | | | | importing a file and importing a directory are really quite different things and the code paths inside the function were completely separate. We also don't have to create a map of ImportedTypes if we are only going to return a single one. Change-Id: Ifbb0caa70e9272dfde2d9f1cf5ed1b102e02f5cc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Add a source location to QQmlJSScopeUlf Hermann2020-10-051-0/+12
| | | | | | | This will come in handy when matching scopes to IR objects. Change-Id: Idff002378a27f08e7d53e8d462311156b0583a8e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Move ScopeType and JavaScriptIdentifier into QQmlJSScopeUlf Hermann2020-10-053-36/+38
| | | | | | | | They don't begin with 'Q' and they are not very useful outside of QQmlJSScope. Change-Id: I3363ac4d29be7a9cb5c9f7f3af1727c99e886825 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Wrap into Qt namespaceUlf Hermann2020-10-0515-0/+60
| | | | | | | As a Qt module, QmlCompiler's classes should live in the Qt namespace. Change-Id: I3138812c288979fe7cff316dd9b63213bd6dfd05 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename TypeDescriptionReaderUlf Hermann2020-10-055-32/+32
| | | | | | | The names should begin with a common prefix. Change-Id: Ibd832ebe7a778c7af8ee3b75253e04491ded28be Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename QmlJSTypeReaderUlf Hermann2020-10-055-14/+14
| | | | | | | Add an extra 'Q' for consistency. Change-Id: I81324f3b6e4d26a29f3bcc40b03abfa137292ea0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename QmlJSImporterUlf Hermann2020-10-054-24/+24
| | | | | | | Add an extra 'Q' for consistency. Change-Id: Idd34e0c898c9a7ac70b1ec3856a8af6829ec6fb7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename QmlStreamWriterUlf Hermann2020-10-054-23/+23
| | | | | | | The names should start with a common prefix. Change-Id: Ib2cc247d459d78de5f0a8ea0be73b89429154475 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename ResourceFileMapperUlf Hermann2020-10-054-14/+14
| | | | | | | The file class names should start with a common prefix. Change-Id: I5e014c103668a1bc73d359b00a1dda33e5637a79 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename ImportedMembersVisitorUlf Hermann2020-10-055-18/+18
| | | | | | | The class names should start with a common prefix. Change-Id: I645ef476f8493d38c2f4c5241d4a2903543f09e8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename metatypes_p.hUlf Hermann2020-10-059-45/+45
| | | | | | | Those are specific to QML/JS. Change-Id: I45a5d4eb6c53bd5ca4026e042af83c4afaa4953c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename ScopeTree to QQmlJSScopeUlf Hermann2020-10-0513-107/+106
| | | | | | | That is a better name. Change-Id: I34a6867692a236dd16ed8e3a68866f994eab02d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live libQtQmlCompiler!Ulf Hermann2020-10-0519-0/+2779
Move all the code from tools/shared into src/qmlcompiler and build a static library from it so that we can re-use it in external tools. Change-Id: I7c8d8e59063dc7c711f4072f103a01095e6f5997 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>