Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Identity preservation in Xtend
Identity preservation in Xtend [message #1862521] Fri, 08 December 2023 15:45 Go to next message
Kaan B. Y. is currently offline Kaan B. Y.Friend
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

Re: Identity preservation in Xtend [message #1862527 is a reply to message #1862521] Fri, 08 December 2023 21:19 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14698
Registered: July 2009
Senior Member
You can always rightclick open generated code and debug there

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Code generation from DSL
Next Topic:Ambiguous rules and Predicate behavior
Goto Forum:
  


Current Time: Fri Jul 19 18:35:25 GMT 2024

Powered by FUDForum. Page generated in 0.03522 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top