eclipse / epsilon

Epsilon is a family of Java-based scripting languages for automating common model-based software engineering tasks, such as code generation, model-to-model transformation and model validation, that work out of the box with EMF (including Xtext and Sirius), UML (including Cameo/MagicDraw), Simulink, XML and other types of models.
https://eclipse.org/epsilon
Eclipse Public License 2.0
53 stars 11 forks source link

EGL template execution clears extended properties in EGX #88

Closed kolovos closed 2 months ago

kolovos commented 2 months ago

Changing the EGX program of https://eclipse.dev/epsilon/playground/?egx as follows

pre {
    for (p in Person.all) {
        p.~index = loopCount;
        p.~index.println();
    }
}

rule Person2TaskList
    transform p : Person {

    template: "template.egl"
    target : "gen/" + p.~index.println() + ".html"
}

post {
    for (p in Person.all) {
        p.~index.println();
    }
}

Should print

1
2
1
2
1
2

however it prints

1
2
1

This is because after template.egl is executed for the first time, it clears the extended properties passed to it from its parent EGX module.