[QVTO] simple mapping constructs [message #533901] |
Mon, 17 May 2010 08:47  |
Eclipse User |
|
|
|
Hi QVTO-folks again,
the following is OK:
mapping Package::transformHelloComplete ( ) : Package
{
init { log ('Init ' ); var packageName := self.name; }
log ('Do' );
name := packageName;
end { log ('End' ); }
}
The following not:
mapping Package::transformHelloComplete ( ) : Package
{
init { log ('Init ' ); var packageName := self.name; }
population { log ('Do' ); name := packageName; }
end { log ('End' ); }
}
The population-block is not accepted. Is there any reason for it? (Yes, I know, why shouldn't I be that lazy and omitt the population keyword and the brackets. )
Thanks for answer,
Siegfried
[Updated on: Mon, 17 May 2010 08:49] by Moderator
|
|
|
|
|
|
Re: [QVTO] simple mapping constructs [message #534696 is a reply to message #534536] |
Wed, 19 May 2010 19:39  |
Eclipse User |
|
|
|
Originally posted by: Alexander.Igdalov.gmail.com
Hi Siegfried,
When "population" keyword is omitted, the text between the init and end
sections is considered to be contained in an implicit object expression.
If you explicitly use "population" keyword, you have to explicitly use
the object expression, otherwise the qvt compiler doesn't have the idea
that you want to update the properties of the mapping result.
BTW, the explicit population section is sensible in cases when a mapping
has multiple results, e.g.:
mapping EPackage::myMapping() : a : EClass, b : EPackage {
population {
object a : EClass { name := 'C'; };
object b : EPackage { name := 'P'; };
}
}
In most mappings the population keyword is not needed at all.
Best,
- Alex.
Siegfried wrote:
> Thanks you all,
>
> the tip with the explicite object expression did it. And it is near to
> the specification example as well (p48), though I really don't
> understand, why. Anyway, it works.
>
> Siegfried
|
|
|
Powered by
FUDForum. Page generated in 0.04154 seconds