Review Request 118225: Minimal support for exported QML components

Denis Steckelmacher steckdenis at yahoo.fr
Tue May 20 16:57:33 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/118225/
-----------------------------------------------------------

(Updated May 20, 2014, 4:57 p.m.)


Review request for KDevelop.


Changes
-------

Move the declaration of the exported alias in a separate method, and shorten the patch by avoiding renaming variables when it is not needed.


Repository: kdev-qmljs


Description
-------

In plugin.qmltypes files, QML components have "C++-ish" names, like "QQmlRectangle". The real QML name can be found in the "exports" property of select components. An export is a string like "QtQuick/Rectangle 1.0". Each component therefore has a namespace, a name and a version.

This patch adds support for exported component names. The namespace and the version are currently ignored, by they may be used in the future in order to tell the user that a component requires an import statement with a greater version number than provided.

Regarding the code quality, I'm not quite happy with the nested if and for loops that I had to add, but the QMLJS parser is again unable to provide a nice "ArrayEntry" node that would have made everything simpler. I'm obliged to iterate over a ElementList node and to cast its expression to a string literal.


Diffs (updated)
-----

  tests/files/plugins.qml 7544a8f 
  duchain/declarationbuilder.cpp 01ebb15 
  duchain/declarationbuilder.h aad8e2b 

Diff: https://git.reviewboard.kde.org/r/118225/diff/


Testing
-------

A test suite has been added. It ensures that a component like this:

Component {
    name: "QAbstractItemModel"
    prototype: "QObject"
    exports: ["QtQuick/AbstractItemModel 1.0"]
}

Is displayed in the outline as "QAbstractItemModel" and "AsbtractItemModel".


Thanks,

Denis Steckelmacher

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140520/11247f12/attachment-0001.html>


More information about the KDevelop-devel mailing list