eclipse-qvto / org.eclipse.qvto

Eclipse Public License 2.0
0 stars 1 forks source link

Provide support for 'object' imperative collect expression shorthand #562

Closed eclipse-qvt-oml-bot closed 1 week ago

eclipse-qvt-oml-bot commented 1 week ago

| --- | --- | | Bugzilla Link | 314443 | | Status | RESOLVED FIXED | | Importance | P3 normal | | Reported | May 26, 2010 07:57 EDT | | Modified | May 23, 2014 02:18 EDT | | Reporter | Siegfried Nolte |

Description

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

eclipse-qvt-oml-bot commented 1 week ago

By Sergey Boyko on May 26, 2010 18:05

(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

eclipse-qvt-oml-bot commented 1 week ago

By Sergey Boyko on May 26, 2010 18:07

I would rather rename this CR to something like "Provide support for 'object' imperative collect expression shorthand".

eclipse-qvt-oml-bot commented 1 week ago

By Alex Paperno on Jul 23, 2013 15:38

Created attachment 233729 The change is made to QVTOParser.gi

:notepad_spiral: bug314443.patch

eclipse-qvt-oml-bot commented 1 week ago

By Alex Paperno on Jul 23, 2013 15:38

Created attachment 233730 A unit test for the patch

bug314443_test.patch

eclipse-qvt-oml-bot commented 1 week ago

By Sergey Boyko on Jul 23, 2013 18:16

Comment on attachment 233729 The change is made to QVTOParser.gi

Good extension to QVTo parse. Junit test covers all proposed changes to grammar.

:notepad_spiral: bug314443.patch

eclipse-qvt-oml-bot commented 1 week ago

By Sergey Boyko on Jul 23, 2013 18:16

Pushed to master.

Commit ID: 602d96ac0533d7fc86b6904bc797afcbf82f6790