| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Alright, this is passing the tests now. Changes:
Other notes:
|
Sorry, something went wrong.
| } | ||
|
|
||
| /** Compiles just the body of a function in whatever is the current context. */ | ||
| private compileFunctionBody(instance: Function): ExpressionRef[] { |
There was a problem hiding this comment.
This one isn't strictly necessary now that I've gone another route, but who knows what it might be good for in the future.
Sorry, something went wrong.
|
LGTM. Is it possible inline constructors for now? |
Sorry, something went wrong.
|
Inlining constructors seems to be limited in usefulness, except for the Pointer experiment we had a while ago where the constructor essentially eliminates itself when inlined after optimizations. Going to take a look, though, as it shouldn't be too hard to get working again (mostly a matter of looking up actual this instead of assuming index 0). One special case is if there's no declared constructor, which in turn isn't decorated @inline and inlining these per-se seems to be inefficient if the class has a lot of fields. Currently in favor of not doing this and relying on the user to actually declare a constructor with the decorator if they want it to be inlined. |
Sorry, something went wrong.
|
Yeah, I mean declare constructor with forced decorator @inline which could be useful for Pointer scenario |
Sorry, something went wrong.
|
Turns out that inlining constructors that didn't return a custom value never worked due to this check preventing it, BUT I think I can at least make the Pointer constructor work again. |
Sorry, something went wrong.
|
Merging, continuing from here :) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
As a follow-up to #445 this PR aims at reworking constructor handling. Currently, whenever a new is encountered, it calls the constructor if it is present and if it isn't, inlines a bare allocation with field initializers at that place. While we could get away with this, generating actual constructors for classes that don't explicitly define one would simplify fixing some remaining issues, while also reducing code size (inlined allocation and initializers quickly accumulate), instead of just working around them.