eclipse-acceleo / acceleo

8 stars 4 forks source link

AQL extend type inference to expressions an not only variable #91

Open ylussaud opened 1 year ago

ylussaud commented 1 year ago

In the following example:

[if  (attribute.eType.oclIsKindOf(ecore::EEnum))]
  return self.get_java_object().[attribute.setterName()/]([attribute.eType.getEnumLiteral('value')/])
[/if]

[query public getEnumLiteral(enum : ecore::EEnum, name : String) : String = 
  'get_enum_literal("' + enum.ePackage.nsURI + '", "' + enum.name + '", ' + name + ')'
/]

We need to cast after attribute.eType so the service getEnumLiteral() can be called. It would be nice to infer the type of attribute.eType to avoid casting.