Initial support for accessing attached properties in-scope.#22
Initial support for accessing attached properties in-scope.#22stephenmdangelo wants to merge 1 commit intoqmlweb:masterfrom
Conversation
|
|
||
| function qml_get_attached_object(type, val) { | ||
| if (type === "name" && qml_is_element(val)) { | ||
| return "$QmlWebGetAttachedObject('" + val + "')"; |
There was a problem hiding this comment.
I don't think this should be on the parser side. Parser should just provide a consumable AST.
|
This adds a code generator to rebuild js functions code, correct? I am not sure this is the correct way (or even the repo) for that. I will need to think about this a bit. The initial plan was to have a codegen separately, but this in fact does relate to the parser, not a complete codegen. Could you also link me to an example why this is needed? |
Yes, it takes the one from UglifyJS.
Yeah, it's admittedly a hack (I don't even know if I can make this entirely transparent to completely arbitrary JS code that references capitalized variables). I'd love to hear some other ideas of how this could be done. I feel like we could make a babel plugin or something, but that would likely force the use of
Here is an example of why this is required: https://github.com/stephenmdangelo/playground/tree/master/qml/scoped_attached_properties I'm less interested in being able to support qualified imports of |
This is to help support: qmlweb/qmlweb#297
Lots of tests fail, but I'm pretty sure that's just because all of the source is regenerated (though I believe still functionally equivalent). QmlWeb tests that fail are any that reference things like
QtandImported, as there is no$QmlWebGetAttachedObjectdefined.I'm mostly interested in any comments about this approach in general. It's currently including a copy of UglifyJS's process.js, with all of the node require/export stuff removed (I couldn't sort out a nice way to put that into replacements.js).