Identity preservation in Xtend [message #1862521] |
Fri, 08 December 2023 15:45 |
Kaan B. Y. Messages: 15 Registered: June 2023 |
Junior Member |
|
|
Hello,
I have the following if-block in a template method on `m`:
«FOR section : m.sections»
// ...
«FOR container : m.containers»
«IF container.targetSection == s»
// ...
«ENDIF»
// NOP, no container transformations for this section
«ENDFOR»
// ...
«ENDFOR»
I have noticed that the if condition is never met, although I can see that one of the sections in `m` occur as the `targetSection` of one of the containers in `m.containers` while debugging; `targetSection` is an EReference without containment, and there is additionally an assertion that checks if the `targetSection` already occurs in `m.sections` whilst populating `m.containers`. So I am sure that the if condition must be met for that one section... but it doesn't. I was wondering if Xtend is perhaps doing some clone operation internally, or perhaps if I should always assume that Xtend will not preserve identities and stick to `equals` instead of `==`.
Thanks in advance.
[Updated on: Fri, 08 December 2023 15:51] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.25731 seconds