| Summary: | Provide support for 'object' imperative collect expression shorthand | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] QVTo | Reporter: | Siegfried Nolte <siegfried> | ||||||
| Component: | Engine | Assignee: | Project Inbox <mmt-qvt.operational-inbox> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | serg.boyko2011 | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | 3.4.0 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
(In reply to comment #0) Hi Siegfried, > > mapping Class::transformClasses( ) : Class > { > name := self.name; > > -- this inline mapping does not work (taken from the spec, p51 below), > -- it delivers nothing > ownedAttribute := self.ownedAttribute->object (p) Property > { > name := p.name; > }; According to QVT Specification, Section "8.2.1.24 ObjectExp" (page 87) such notation is just shorthand for xcollect() call: When an object expression is the body of an imperative collect expression (see xcollect in ImperativeLoopExp), the reference to the collect construct may be skipped and the arrow symbol applies on the object keyword. list->object(x) X{… } // shorthand for list->xcollect(x) object X{ … } And this shorthand is not yet supported by QVTo. That is why you'll get 'token "object" is invalid' syntax error for the mentioned inline mapping call. > > -- this OCL solution does > ownedAttribute := self.ownedAttribute->collect( p | object Property > { > name := p.name; > } ); > } > > The metamodel is UML, the model is a simple Class diagram. > > Reproducible: Always I would rather rename this CR to something like "Provide support for 'object' imperative collect expression shorthand". Created attachment 233729 [details]
The change is made to QVTOParser.gi
Created attachment 233730 [details]
A unit test for the patch
Comment on attachment 233729 [details]
The change is made to QVTOParser.gi
Good extension to QVTo parse. Junit test covers all proposed changes to grammar.
Pushed to master. Commit ID: 602d96ac0533d7fc86b6904bc797afcbf82f6790 |
Build Identifier: 20090619-0625 mapping Class::transformClasses( ) : Class { name := self.name; -- this inline mapping does not work (taken from the spec, p51 below), -- it delivers nothing ownedAttribute := self.ownedAttribute->object (p) Property { name := p.name; }; -- this OCL solution does ownedAttribute := self.ownedAttribute->collect( p | object Property { name := p.name; } ); } The metamodel is UML, the model is a simple Class diagram. Reproducible: Always