Open Harbs opened 2 years ago
I can look into this, but probably not until late December or early January - feel free to assign to me unless others want to take it on first. On a related note, does anyone know why there is a 'names' Array instance in the ROYALE_CLASS_INFO - we only ever have one element in these, and it is always accessed as ROYALE_CLASS_INFO.names[0].qName, for example. I assume it could be changed to be a single Object with name, qName , etc. Also there are a few places where this is used directly I think (outside of the Reflection lib). Slightly OT: I have vague notions of other ways to support reflective functionality that might be more selective (for tuning the amount of reflection data in the final build, for example) so I might give that a shot at some point too.
Just some random investigation out of curiosity. I couldn't remember if the fully qualified names have always been compiled into release builds like this, or if it was something that was (perhaps unintentionally) introduced at some point more recently. I went as far back as Royale 0.9.0, and that version also included the qnames in release builds. I doubt it was any different in older FlexJS builds.
Well, it seems like that was only partially the issue. I created a branch (feature/ROYALE_INTERFACE_INFO
) which moves the interface data out into a separate variable and Language uses that. That still didn't fix the issue for me and I see that the problem still exists because of SimpleCSSValuesImpl
. SimpleCSSValuesImpl
uses ROYALE_CLASS_INFO
in getValue
. I'm pretty sure it uses that to walk up the super-classes to find defaults for beads and the like.
I confirmed that switching to SimpleValuesImpl
makes the class names go away. Of course that's not really a solution because that breaks the vast majority of apps.
I'm not sure what the right solution is. Preserving class names for classes which have CSS lookups seems like it might be necessary. I'm not sure how else we can preserve those lookups. Any thoughts on that? But even if yes, not EVERY class needs those lookups. Most classes will never be accessed by the valuesImpl
... Not sure what to do...
One more thing that we probably need to do to prevent rename issues is to make sure the compiler doesn't add quotes to the property names: ROYALE_CLASS_INFO
, ROYALE_INTERFACE_INFO
and ROYALE_INTERFACE_INFO
.
I added exceptions here: https://github.com/apache/royale-compiler/commit/6c1bd52f8942bff982b09ffcbc7e33dffeb51dfd
I'd appreciate if someone who's more familiar with the compiler code looks at what I did. I don't know if there's a better way to do it...
Using this simple app:
If you compile using this config:
You get this at the top of the minified code:
That's a lot of unnecessary cruft.
My best guess on why that's happening is:
name
andqname
is preserved.Only the interface information is needed by Language. The
name
andqname
are only needed for reflection.The solution is probably to separate the class
name
andqname
from the interface dependencies. It seems like they should be two variables.That should free up
name
andqname
to be removed unless Reflection is used.Names that make sense would be
ROYALE_CLASS_INFO
andROYALE_INTERFACE_INFO
. A question I have would be whether pulling out the interface info might cause problems for existing SWC libraries. Probably yes, but requiring rebuilding SWCs is probably reasonable.