| Summary: | Inappropriate behavior when calling query with a parameter name equals to template caller paramater name | ||
|---|---|---|---|
| Product: | [Modeling] Acceleo | Reporter: | Mikaël Barbero <mikael.barbero> |
| Component: | Core | Assignee: | Project Inbox <acceleo-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | laurent.goubet, mikael.barbero |
| Version: | 3.0.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
This is only reproducible in this very particular case of a query with two parameters, the first _parameter_ being named the same as the second _argument_ passed to the call. [test(x, c)/] <- this c [query public test(c : T, y : U)/] <- and this one When Acceleo evaluates the value of the parameter c, "c = x", it replaces the value of the variable named "c". Then, when it evaluates the value of the parameter y, "y = c", it will use the new value of "c" instead of the old one. This cannot be reproduced in any other configuration (even with identical templates) than this. Only ever raised once and too specific to adress. |
Hi guys, Here is a sample module to reproduce the behavior: [comment encoding = UTF-8 /] [module test('http://www.eclipse.org/emf/2002/Ecore')/] [template public test(e : EPackage)] [comment @main /] [file (e.name + '.txt', false, 'UTF-8')] [for (it : EClass | e.eClassifiers->filter(EClass))] q1: [it.q1(e)/] q2: [it.q2(e)/] [/for] [/file] [/template] [query public q1(e : EClass, ep : EPackage) : String = ep.name + '.' + e.name /] [query public q2(ec : EClass, pa : EPackage) : String = pa.name + '.' + ec.name /] Despite q1 and q2 should do the same thing, the output is (with Ecore.ecore as input model) : q1: EAttribute.EAttribute q2: ecore.EAttribute q1: EAnnotation.EAnnotation q2: ecore.EAnnotation q1: EClass.EClass q2: ecore.EClass q1: EClassifier.EClassifier q2: ecore.EClassifier q1: EDataType.EDataType q2: ecore.EDataType [....] Strange, isn't it? Mikael