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
Eclipse UserFriend
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] by Moderator

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
Eclipse UserFriend
You can always rightclick open generated code and debug there
Previous Topic:Code generation from DSL
Next Topic:Ambiguous rules and Predicate behavior
Goto Forum:
  


Current Time: Sat Feb 15 10:31:15 GMT 2025

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

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

Back to the top