aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsscope_p.h
Commit message (Collapse)AuthorAgeFilesLines
* qmllint: Resolve attached property scopesUlf Hermann2021-02-191-2/+2
| | | | | | | | | Previously, all attached property scopes were just ignored. Task-number: QTBUG-84369 Change-Id: I324becf92402eacea9d150e6e51359edae562dde Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit f34ecc8f99522b69d1aaa3d5d233add9ed9b6da9)
* qmllint: Remove exceptions for most unknown builtinsUlf Hermann2021-01-211-7/+8
| | | | | | | | | | | | All those types are properly defined in the qmltypes files now. We just need to search the enumerations the same way as methods and properties in order to find everything. Also, deduplicate the code that resolves properties, methods, and enums by using a common template for iterating the scopes. Change-Id: I0bf1423974d0ec8f602ecd0342522b3e981a8586 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlJSScope: Fix typoUlf Hermann2021-01-201-1/+1
| | | | | | Change-Id: Idb29a7483b813ed00849c13ef1324c7e931400de Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Support extended typesUlf Hermann2021-01-201-0/+7
| | | | | | | Fixes: QTBUG-90448 Change-Id: I5fb6b3d9223ae95ca7e039c5b9139ed086052c29 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Make QQmlJSScope const-correctUlf Hermann2020-12-031-2/+19
| | | | | | | | | You should not be able to retrieve a non-const parent or child scope from a const scope. That defeats the whole point of keeping the scopes const after loading. Change-Id: If3734c65ee902c32939a54a67193d5f6276cd016 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Unify parsing of QML components, JS programs, ES modulesUlf Hermann2020-11-251-1/+4
| | | | | | | | | There is no reason to duplicate the code for retrieving method signatures 3 times over. As an added benefit, the types on those methods are resolved now. Change-Id: I2f9681911b938c4a260b6593ab49e9cc5098c546 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Expose interface informationMaximilian Goldstein2020-11-231-0/+4
| | | | | Change-Id: Ica3f5c6696542921bc8d399cd46d901ba06f6d83 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QmlCompiler: Fix resolution of method and property typesUlf Hermann2020-11-181-2/+2
| | | | | | | | | | | | | | | | We need to resolve the types for QML elements in two passes because only after finishing the parsing we have the QML-declared methods and properties available. We already need the base type before, though. Also, there can be multiple methods of the same name. We need API to access them. It also turns out that the internal name of the "var" type has to be QVariant in order to match reality. "var" properties and unnamed arguments to JS functions are implemented as QVariant. Change-Id: I541f11e96db72d832f4e4443d3a5d31079a56575 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Add method to get first non-composite base scopeUlf Hermann2020-11-121-0/+9
| | | | | | | That's a recurring thing. Change-Id: I8dc049a559e337c70089dd1f81ff23bf7d2140fe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Allow more convenient access to enums in QQmlJSScopeUlf Hermann2020-11-121-3/+8
| | | | | Change-Id: Ibac4dd7641a89b686bee63cf974b2257a35631a2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Integrate sequences with registration macrosUlf Hermann2020-11-111-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | You get to write QML_SEQUENTIAL_CONTAINER(value_type) now, and qmltyperegistrar will generate a sensible registration call from that. A registration might look like this: struct MyStringListForeign { Q_GADGET QML_ANONYMOUS QML_SEQUENTIAL_CONTAINER(QString) QML_FOREIGN(MyStringList) QML_ADDED_IN_VERSION(3, 1) }; It's unfortunate that we need to use a metaobject to transfer all of this information, but there is no other sensible way. Transform the containers defined in qv4sequenceobject.cpp to use the new style, and move them out of the builtins, into QtQml. Recognize that only one of them was ever tested, and add tests for the rest. Task-number: QTBUG-82443 Change-Id: I3a30f9e27266bb575eea26c5daf5dad1ec461cc5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Introduce grouped scopesUlf Hermann2020-10-271-1/+3
| | | | | | | | This way we can analyze the left hand part of things like "anchors.fill: parent" in qmllint. Change-Id: I0f58312566c3d5062e0fb301c2bad908ab8b8cbb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Properly discern between inherited and own namesUlf Hermann2020-10-221-9/+14
| | | | | | | | | | | 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: Drop the metaobject revision from exportsUlf Hermann2020-10-191-10/+2
| | | | | | | | | 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>
* QQmlJSScope: Add a way to retrieve a single method or propertyUlf Hermann2020-10-161-0/+2
| | | | | Change-Id: Icf8f2aae869176ed864dcdd3b4231e71043cb0bc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QDeferredPointer: Remove the factory before executing itUlf Hermann2020-10-151-5/+2
| | | | | | | Only this way we avoid infinite recursion on cyclic references. Change-Id: I4d6323a093d17f7d55965dc40f9dc5f1a647df9c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Defer resolution of types read from QML filesUlf Hermann2020-10-151-5/+36
| | | | | | | | | | 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>
* 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-051-21/+22
| | | | | | | | 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-051-0/+4
| | | | | | | 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 metatypes_p.hUlf Hermann2020-10-051-12/+12
| | | | | | | Those are specific to QML/JS. Change-Id: I45a5d4eb6c53bd5ca4026e042af83c4afaa4953c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename ScopeTree to QQmlJSScopeUlf Hermann2020-10-051-0/+221
That is a better name. Change-Id: I34a6867692a236dd16ed8e3a68866f994eab02d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>