Closed TGlide closed 1 week ago
Btw this is only true for private fields REPL.
This is because when a private field is accessed with this
the code get's converted by adding a .v
at the end which actually set the value of the signal. By doing it on an instance
you are tricking the compiler in not doing that.
while with public fields the set still goes through the setter which actually does a set
on the signal.
Basically here we should check if node.object.type is ThisExpression
but also if the name is any name to which this has been assigned to:
Is This the same as #11476 ? I think the easiest solution is to have a private getter/setter pair for each private state/derived backed by another private field. Bonus points for only doing that when we need to (i.e. when we detect this is assigned/passed to something)
Is This the same as #11476 ? I think the easiest solution is to have a private getter/setter pair for each private state/derived backed by another private field. Bonus points for only doing that when we need to (i.e. when we detect this is assigned/passed to something)
Yeah I think is the same. Since the problem is only there with private fields because public gets rewritten to private+get&set even if you return this you'll have no way to access them outside.
I like your idea...we should explore every method of the class to be sure this is not assigned to a class property right?
I would add metadata.needs_private_getters to the class node and set that to true in the analysis phase when detecting a this expression that is not the first part of a member expression. Then in the code gen phase create those private getters/setters if that field is true
I would add metadata.needs_private_getters to the class node and set that to true in the analysis phase when detecting a this expression that is not the first part of a member expression. Then in the code gen phase create those private getters/setters if that field is true
Great I'll try to give it a shot tomorrow if I have time.
Describe the bug
When using an alias for
this
in a Class with runes, setting a state using the alias breaks the signal.Reproduction
REPL
Try to undo something on the 2nd example
Logs
No response
System Info
Severity
annoyance