-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Abstracts In Hscript #3777
Conversation
9338b19
to
5b33886
Compare
Does this work for abstract classes like |
For now it probably won't work, but i want to add support for it Currently atleast all the funkin abstracts and FlxColor work |
The error |
i already removed it |
can you give me your source code? |
oh btw i got this now
|
|
I found the issue: for (abstractCls in abstractClasses)
{
for (abstractCls in sortedAbstractClasses)
{ this should only loop through sortedAbstractClass, so you need to remove |
1ebf2ed
to
e9a1ee4
Compare
I'm probably going to reject this as I already have a work in progress for this for Polymod. |
Im kind of interested in the implementation, is it actual support for abstracts or is it something similar to mine, meaning something like the wrappers im using. Having actual support for abstracts would be fire. |
e9a1ee4
to
0cd81f0
Compare
0cd81f0
to
3145a4a
Compare
3145a4a
to
ef1624b
Compare
If you look at the compiled game code, the wrapper actually exists internally. For example, |
Oh, so the static variables not existing were a bug. I was going crazy when I tried using the "Impl" classes. I mean my current implementation does get the static variables, but I completely forgot how I did that. |
The static variables "exist", but they aren't accessible via reflection (that's the bug). I think I was going to look into a hybrid solution, where I use reflection for the methods and a macro for the fields; that, or create a PR to HXCPP that properly adds the static variables to the reflection table. |
Do you have a branch of polymod implementing the abstracts. I believe it makes more sense if I try out things, using your implementation. |
yeah its right in the experiment/static-fields branch, ig |
Correct. This branch also has some other experimental changes such as allowing static fields and methods which can be accessed from other modules, as well as other changes to help fix some issues with querying assets in Lime asset libraries. |
I've opened a pull request in the polymod repository, which adds support for reading static member variables. |
DESCRIPTION
This pr aims to make it possible to import abstract classes or enums.
The macro creates "wrappers" around the actual abstract.
NOTE
Currently these packages/classes are not supported:
thx.Set
(Template issue, specifically not being able to cast Dynamic to some other type)cpp.*
(some issue with cpp.Function.fromStaticFunction)lime.*
(Somehow duplicate fields, could not determinte type for parameter T)openfl.*
(Somehow duplicate fields, could not determinte type for parameter T)EXPLANATION
For example
flixel.util.FlxColor
:We create a class
polymod.abstracts.flixel.util.FlxColor_
.This class has all static fields of
flixel.util.FlxColor
, and just calls the respective fields from the actualflixel.util.FlxColor
class. We then create an alias forflixel.util.FlxColor
and make it point topolymod.abstracts.flixel.util.FlxColor_
.We also create a public static function called
create
, which will just call the constructor of theflixel.util.FlxColor
.EXAMPLES
TODO