[Acceleo3] Strange template invocation error [message #665572] |
Fri, 15 April 2011 06:56  |
Wilbert Alberts Messages: 209 Registered: June 2010 |
Senior Member |
|
|
Hi,
I'm encountering a strange problem. My template module contains the following template definition:
[template private genParamDecls(ds: OrderedSet(PG_FuncParam)) post(trim())]
[for (d : PG_FuncParam| ds) separator (', ')][generateCDeclaration(d.name, d.type, OrderedSet(PG_Dimension){})/][/for]
[for (d : PG_FuncParam| ds) separator (', ')][generateCDeclaration(d.name, d.type, d.dimensions)/][/for]
[/template]
The generateCDeclaration template is defined in a different module (which obviously is included here). It looks like:
[template public generateCDeclaration(s: String, t: PG_Type, ds: OrderedSet(PG_Dimension)) post(trim())]
[genCDecl(s, t, ds)/]
[/template]
PG_FuncParam specialises PG_TypedElement which contains the PG_Dimension sequence:
class PG_TypedElement extends pg_core::PG_NamedElement { abstract }
{
property type : PG_Type[1];
property dimensions : PG_Dimension[*] { composes };
}
The problem is that acceleo detects an error in the second of the two 'for' loop invocations (from above), the one that operates on d.dimensions.
The moment I copy the generateCDeclaration template definition to the module containing its invocation, the error disappears. However, that is not an option as it would require copying the whole module.
Anyone having an idea what is going on here?
Greetings,
Wilbert.
|
|
|
Re: [Acceleo3] Strange template invocation error [message #665587 is a reply to message #665572] |
Fri, 15 April 2011 07:51   |
Wilbert Alberts Messages: 209 Registered: June 2010 |
Senior Member |
|
|
Hi,
I must admit that the module containing the generateCDeclaration also contains another template definition:
[template public generateCDeclaration(s: String, t: PG_Type, ds: OrderedSet(PG_Dimension)) post(trim())]
[genCDecl(s, t, ds)/]
[/template]
[template public generateCDeclaration(te : PG_TypedElement) post(trim())]
[genCDecl(te.name, te.type, te.dimensions)/]
[/template]
As the PG_FuncParam also is an PG_TypedElement I was able to change the invocation of the template from:
[template private genParamDecls(ds: OrderedSet(PG_FuncParam)) post(trim())]
[for (d : PG_FuncParam| ds) separator (', ')][generateCDeclaration(d.name, d.type, d.dimensions)/][/for]
[/template]
into:
[template private genParamDecls(ds: OrderedSet(PG_FuncParam)) post(trim())]
[for (d : PG_FuncParam| ds) separator (', ')][generateCDeclaration(d)/][/for]
[/template]
This modification made my module work but I don't understand why....
Greetings,
Wilbert.
|
|
|
|
Powered by
FUDForum. Page generated in 0.01215 seconds