- changed title to getXNoTransform() for NTAs
getXNoTransform() for NTAs
When an NTA is declared in the .ast file with the /X/ syntax, then a getXNoTransform() method is generated, but it does not calculate the value of the NTA - only calls getChildNoTransform(). Thus, if you call getXNoTransform() before the first call to getX(), you will get null.
I would expect the NTA to be calculated, but no rewrites triggered.
Comments (8)
-
Account Deactivated reporter -
Account Deactivated reporter - edited description
-
- changed status to resolved
Compute NTA components via getXNoTransform()
Accessing an NTA component via getXNoTransform() now returns the NTA value, instead of returning the uninitialized NTA, i.e. null.
fixes #215 (bitbucket)
→ <<cset 7e668c176a69>>
-
Account Deactivated reporter It looks like getXNoTransform() now is equivalent to getX()? Is that true? That would seem to invalidate the reason for even having it in the first place. I agree that it is better than the previous behavior, though.
-
Yes, this made
getX()
andgetXNoTransform()
equivalent for NTA components. However, it's good to havegetXNoTransform()
generated for all components just for symmetry, and makinggetXNoTransform()
actually skip rewrites in this case would mean a much bigger change in JastAdd because the rewrite is built-in to the method that computes the NTA. -
I have to reopen this issue because the fix introduced another bug, see
#261. -
- changed status to open
Revert NTA getXNoTransform change
Reverted change for issue #215 because it introduced errors in inherited attribute evaluation.
reopen #215 (bitbucket)
→ <<cset 732a95aad113>>
-
Account Deactivated reporter How about adding a getXNoCreate() method that for normal children just calls getXNoTransform(), and for NTAs has the old behavior of getXNoTransform(). If you then use getXNoCreate() when calculating inherited attributes, then you can re-introduce your change.
Moving the rewrites on NTAs to getChild()/getX() and having getXNoTransform() only create without triggering the rewrites could then be a possible future enhancement.
- Log in to comment