qmlweb / qmlweb-parser

A QML parser in JavaScript
Other
27 stars 11 forks source link

api: Support assigning qualified qmlelem to a property #18

Closed stephenmdangelo closed 7 years ago

stephenmdangelo commented 8 years ago

e.g.

import QtQuick 2.5 as QQ

Repeater { delegate: QQ.Rectangle {} }

ChALkeR commented 7 years ago

@stephenmdangelo, sorry for not reviewing at this earlier. In general, I'm in favor of this PR (and thanks for doing this!), but it requires some changes before landing. See the review above.

stephenmdangelo commented 7 years ago

@ChALkeR So I've cleaned up the Properties.json test (as well, I added a change to tape.js to fix the tests failing if, say, I was editing in vi).

I think I'm generating the dot expression as you're suggesting.

Though I find it odd that the expr as returned by maybe_assign is of the form:

[
  "dot",
  "DOM",
  [
    "name",
    "DOM"
  ],
  "Div"
]

But a non-assigned qmlelem (as in ImportsNamed.qml) omits the name array:

[
   "dot",
   "DOM",
   "Div"
]

So I went with the latter form. Is this correct? If so, why don't we use the name format, or why does that format get returned by maybe_assign?

ChALkeR commented 7 years ago

I will take a look at maybe_assign a bit later, though. =)