aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmldom/qqmldomcomments_p.h
Commit message (Collapse)AuthorAgeFilesLines
* qmldomcomments: include comment start string in the comment locationSemih Yavuz2024-05-071-4/+7
| | | | | | | | | | | | | | Parser doesn't take comment start strings into account. So, // or /* is not the part of the source location. Add this via this post-processing. The full comment region is required for semantic highlighting. This is obviously not the correct layer for a fix. The actual fix should go in the parser level which is tracked by QTBUG-124897. Task-number: QTBUG-124897 Task-number: QTBUG-120000 Change-Id: I1759edf512c21809955531ba6d5dfe4ec2f7d678 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add source location info to CommentSemih Yavuz2024-04-111-4/+9
| | | | | | | | | We need to know source location of comments for semantic highlighting. Task-number: QTBUG-120000 Change-Id: I37cccf06c441a3da51aacde19eead57ccaae53d0 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qqmldomcomment: Remove dead codeSemih Yavuz2024-04-111-1/+0
| | | | | | | Task-number: QTBUG-120000 Change-Id: I4ef8195cbf41449c6ec63fa59c769c08e013765c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Correct license for module and plugin fileLucie Gérard2024-04-091-1/+1
| | | | | | | | | | | | | | | | | | According to QUIP-18 [1], all module and plugin files should be LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only or LicenseRef-Qt-Commercial OR GPL-3.0-only Also, LGPL and non LGPL should not be mixed in a given directory [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I812452a951b38cd3937a66314c457e3e361e63e9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qqmldomcomments: link comments to nodes or regions by CommentCollectorSemih Yavuz2024-02-221-7/+22
| | | | | | | | | | | | | That used to live in AstComments which actually represents comments linked to AST::Node's. Instead, let's use a separate class for this job. Document and refactor methods which link comments to the elements and provide readable variable names. Task-number: QTBUG-120484 Change-Id: Ie238b9bab5f610c7cdb08a16f0cbf4802e922306 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qqmldomcomments: Add comment type in Comment classSemih Yavuz2024-01-221-12/+40
| | | | | | | | | | | | | | | | Comment class obviously represents a comment. By design, a comment can be attached to a node or a dom region. Attachment can take place as a preComment or a postComment. Introduce an enum that represents the comment type. Also, provide better encapsulation in comment handling classes by hiding members and remove some methods from the class interface. Task-number: QTBUG-120484 Change-Id: I995fe97e2fc0a2980e43a6d529309cb18efba434 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmldomcomments:Get rid of redundant itemsSemih Yavuz2024-01-221-3/+1
| | | | | | | | Task-number: QTBUG-120484 Change-Id: Ia7b01166f23c93997f43c0d6d46e54c4edb7e938 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* QmlDom: Pass arguments by const ref, next roundUlf Hermann2023-12-151-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | In some of those places we could move instead, but let's first get the basics right. Coverity-Id: 433005 Coverity-Id: 433004 Coverity-Id: 433003 Coverity-Id: 433001 Coverity-Id: 432999 Coverity-Id: 432998 Coverity-Id: 432997 Coverity-Id: 432996 Coverity-Id: 432995 Coverity-Id: 432993 Coverity-Id: 432992 Coverity-Id: 432991 Coverity-Id: 432989 Coverity-Id: 432988 Change-Id: I90680511aec16fdd05b632dbdfa44d3cac1d09d0 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmldom: introduce FileLocationRegion enum as key for sourcelocationsSami Shalayel2023-11-011-7/+7
| | | | | | | | | | | | | | | | | | | | | | | Previously in the Dom, SourceLocations and comments were stored in QMaps and keyed by strings (so-called region names). This commit replaces the string keys with a newly introduced enum called FileLocationRegion. Replace the QMaps in FileLocations::{regions,preCommentLocations,postCommentLocations} and RegionComments::{preComments,postComments} to key by FileLocationRegion enum instead of string, along with all their usages. The DomItem Dom::Map interface requires the above-mentioned maps to be able to key by string, so implement two helper methods fileLocationRegionValue() and fileLocationRegionName() in qqmldom_utils that can translate a string to FileLocationRegion and back. Those two helpers are used to construct a Dom::Map in Map::fromFileRegionMap and Map::fromFileRegionListMap. Add a test for Dom::Map constructed in that way. Change-Id: I185a4114c9db9f86d9e219079d12d833abfe590e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmldom: Fix coverity warningsUlf Hermann2023-09-151-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | - initialize members - iterate const containers, and use const refs for elements - pass values by reference - provide move constructors Coverity-Id: 417104 Coverity-Id: 417102 Coverity-Id: 417101 Coverity-Id: 417100 Coverity-Id: 417099 Coverity-Id: 417098 Coverity-Id: 417097 Coverity-Id: 417096 Coverity-Id: 417095 Coverity-Id: 417094 Coverity-Id: 417093 Coverity-Id: 417092 Coverity-Id: 417090 Coverity-Id: 417088 Coverity-Id: 417087 Coverity-Id: 417086 Coverity-Id: 417085 Change-Id: I624ed4e71c49c3eebced9483dd73554dbdcb981b Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QmlDom: Add const-correctnessUlf Hermann2023-09-151-7/+7
| | | | | | | | | | We almost never want non-const DomItems anywhere. There is exactly one exception: From a MutableDomItem we need to poke into the internals of the respective DomItem and const_cast them. However, MutableDomItem is to be handled with care anyway. Change-Id: I826f0669c049462beec9ad71dccb39c5191a1d3f Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-2/+2
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlJS::Dom: Use std::make_sharedLeticia Valladares2022-07-141-1/+1
| | | | | | | | | | Use std::make_shared<T>() over shared_ptr(new T) to perform a single memory allocation. Fixes: QTBUG-103948 Change-Id: I8a3a89f20265052ea80c1d68bb1247324e961f8f Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-27/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qmldom: representation and load of Qml FilesFawzi Mohamed2021-06-051-0/+339
- qqmldomitem: main API for generic access to the Dom - qqmldomtop: represent top level elements: DomEnvironment and Universe - qqmldomelements: definition of the classes representing Qml - qqmldomastcreator: instatiate Dom elements from AST - qqmldomcomments: represent comments in Qml - qqmldomexternalitems: represent files - qqmldommoduleindex: represent types in a module - tst_dom_all: combined test running all dom tests Change-Id: If2320722bc3e6eaab9669ecec6962d5473184f29 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>