Skip to content

Commit a5c3ceb

Browse files
authored
qmlpropdef: support parsing list property types
Note that subtype is not exported to the result yet, but that is still better than not parsing them at all We should later export the additional type information in some form, hopefully without breaking backwards compatibility. Fixes: #33 PR-URL: #34
1 parent b281c25 commit a5c3ceb

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/api.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,15 @@ function qmlweb_parse($TEXT, document_type, exigent_mode) {
221221
function qmlpropdef() {
222222
var type = S.token.value;
223223
next();
224+
225+
var subtype;
226+
if (is("operator", "<")) {
227+
next();
228+
subtype = S.token.value;
229+
next();
230+
expect_token("operator", ">");
231+
}
232+
224233
var name = S.token.value;
225234
next();
226235
if (type == "alias") {

tests/qml/Properties.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ Rectangle {
1414
property var foo: {}
1515
property var bar: []
1616
property Item item: Item {}
17+
property list<Item> items
1718
}

tests/qml/Properties.qml.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@
151151
[]
152152
]
153153
],
154-
"Item {}\n"
154+
"Item {}\n "
155+
],
156+
[
157+
"qmlpropdef",
158+
"items",
159+
"list"
155160
]
156161
]
157162
]

0 commit comments

Comments
 (0)