[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2t] Re: [Acceleo] Let block syntax

Hi,

I believe it works if you add oclAsType:
[let ac : AssociationClass = c.oclAsType(AssociationClass) ]

--
regards,
Loïc Fejoz

laurent Goubet a écrit :
Hi Guillaume,

Until recently, the let blocks couldn't be parsed when the type of their initilalisation wasn't right ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=242744 ). This has been fixed, but you'll have to wait for the next integration build.

Laurent Goubet
Obeo

Guillaume Bourel a écrit :
Hey,

I was wondering how to use the [let] block within Acceleo :

I tried the same syntax as in http://www.omg.org/spec/MOFM2T/1.0/

[template public classToJava(c : Class)]
[let ac : AssociationClass = c ]
class [c.name/]
{
// Constructor
[c.name/]()
{
}
// Association class methods
[for (t:Type | ac.endType)]
Attach_[t.name/]([t.name/] p[t.name/])
{
// Code for the method here
}
[/for]
}
[/let]
[/template]


But "ac.endType" raise the following error : "Init expression type does not conform to type of variable (ac)."

Did I miss something ?