<div dir="ltr">Hi Anton!<div><br></div><div>I have implemented initial version of imports. They work! ;-)</div><div>The code in my original pull request: <a href="https://github.com/akreuzkamp/qmlweb/pull/1">https://github.com/akreuzkamp/qmlweb/pull/1</a></div><div><br></div><div>p.s. Probably that pull request is "stale". Please note me and I will try to do something...</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">С уважением,<br>Павел Васёв</div></div>
<br><div class="gmail_quote">2015-03-13 13:42 GMT+05:00 Pavel Vasev <span dir="ltr"><<a href="mailto:pavel.vasev@gmail.com" target="_blank">pavel.vasev@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Anton!<br clear="all"><div><div><br></div><div>I tried to use/implement import statement.</div><div><br></div><div>Because it is already semi-implemented, I hoped it will be</div><div>easy task. However I cannot complete it without your help.</div><div><br></div><div>1. Could you please fix parser to allow "." (dot) in component names. E.g:</div><div>``````````````````````````````````````</div><div>import components.scatter 1.0 as ScatterScene<br></div><div><br></div><div>Item {</div><div>  ScatterScene.App </div><div>  {</div><div>  ^ Parser says here: Unexpected token punc undefined, expected punc</div><div>  }</div><div>}</div><div>``````````````````````````````````````<br></div><div>Probably this is not a "dot in component names" problem, but it anyway refuses to parse...</div><div><br></div><div><br></div><div>2. Path lookup - need your advice.</div><div><br></div><div>I found that `parseQML` function returns $imports array. </div><div><br></div><div>I checked and see that after parseQML you always call</div><div>`new QMLComponent` method. E.g:</div><div>``````````````````````````````````````````````</div><div><div>    var tree = parseQML(src);</div><div>    var component = new QMLComponent({ object: tree, context: executionContext });<br></div><div>```````````````````````````````````````````````</div><div>So I think it is possible to keep `tree.$imports` value somewhere in component,</div><div>here or inside QMLComponent constructor.</div><div><br></div><div>The goal for keeping $imports of current component is to have access to it in <br></div><div>`construct` function when constructing the children of current document. </div><div><br></div><div>We can perform some cached lookups of qmldir files contents and decide whenever we should use component from some qmldir file.</div><div><br></div><div>For now, I digged a little to your code and I cannot understand, where is it better to keep $imports? I tried metaobject, and context, but seems they are not what I need.</div><div>Could you please make some advice?</div><div><br></div></div><div>Best Regards,</div></div><div>Pavel</div><div><br></div><div>p.s. I understand that most of your efforts currently are on qml-to-js convertor. </div><div>However it doesn't seem to be ready tomorrow, because it is not easy task. </div><div>And current parser/qtcore are "working things". So please give some attention to them too, because they are just working... Thank you!</div>
</div>
</blockquote></div><br></div>