-
Notifications
You must be signed in to change notification settings - Fork 30
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
Wrong Code Gen for Abstract Static Functions in Module #860
Comments
I think |
Thanks for the prompt reply.
I want to construct a Class instance from within a Module. That is, what I really want is to be able to write
I had a feeling this was the case. Admittedly, |
Yes, I don't know if it makes sense to support creating new objects of thistype in module.
But then you could just as well sue abstract class :D |
Thanks again for the quick reply and for the code sample. :) The problem with Let me try to provide a motivating example:
Now I can call |
Hm yeah, I suppose it would save on some boilerplate code if you do this to many classes. |
Thanks for considering the use case. :)
Yes, the key idea is to shave off boilerplate code through abstraction. I already have three classes in my map that use a variant of the above-mentioned module. There is the CameraControl class for instance. It centralizes per-player camera management. E.g., for cinematics, presentations, or "fixed zoom".
That is nicely spotted! :) The short code example was too contrived, I guess (I tried to remove irrelevant parts). The actual Character class doesn't simply use |
I think that I've found an issue with the code generation. The following code reproduces the issue:
This produces the following function (from
compiled.j
):The body is just
return 0
. It should have been the jass equivalent ofreturn new TestClass(i)
.The motivation for a static
_construct
is to be able to construct instances ofthistype
in a Module. Currently, the codenew thistype(42)
doesn't compile.The text was updated successfully, but these errors were encountered: