Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Common features not lifted to super class(problem in the typesystem demo project)
Common features not lifted to super class [message #1053450] Mon, 06 May 2013 03:26 Go to next message
paul lu is currently offline paul lu
Messages: 14
Registered: April 2013
Junior Member
Hi,

I'm trying the typesystem demo project: http://code.google.com/a/eclipselabs.org/p/xtext-typesystem/downloads/list
For the following:

Element:
VarDecl | Formula
;

VarDecl returns Symbol:
{VarDecl} "var" type = Type name = ID ";"
;
Formula:
"calc" type = Type name=ID "=" expr=Expr ";"
;

I got stuck at "ExprDemoPackage.eINSTANCE.getElement_Type()", since there's no such method generated.
But isn't there supposed to be one? I didn't see "type" "name" as the common features in class "Element", but they are in "VarDecl" and "Formula", should they be lifted to the super class?
Re: Common features not lifted to super class [message #1053482 is a reply to message #1053450] Mon, 06 May 2013 08:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6307
Registered: July 2009
Senior Member
Hi,

do you have any other symbols? (returns Symbol)
Re: Common features not lifted to super class [message #1053632 is a reply to message #1053482] Tue, 07 May 2013 00:56 Go to previous messageGo to next message
paul lu is currently offline paul lu
Messages: 14
Registered: April 2013
Junior Member
Thanks, I see, in this case, it's
VarDecl -> Symbol -> Element
Formula -> Element
but I think it also makes sense to put "name" and "type" features into "Element" ?
Re: Common features not lifted to super class [message #1053650 is a reply to message #1053632] Tue, 07 May 2013 07:12 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2832
Registered: July 2009
Senior Member
Am 07.05.13 02:56, schrieb paul lu:
> Thanks, I see, in this case, it's
> VarDecl -> Symbol -> Element
> Formula -> Element
> but I think it also makes sense to put "name" and "type" features into
> "Element" ?

The logic is described in the documentation.
Features are only pulled up into the super type if all subtypes have
them in common. Does 'Element' have other subtypes?

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Common features not lifted to super class [message #1053866 is a reply to message #1053650] Wed, 08 May 2013 01:26 Go to previous message
paul lu is currently offline paul lu
Messages: 14
Registered: April 2013
Junior Member
Yes, this doesn't apply to this case, as subtype "Symbol" doesn't contain the common features

Thanks !
Previous Topic:Cast of an IEObjectDescription object
Next Topic:global scope and importedURI
Goto Forum:
  


Current Time: Sun Sep 21 02:05:13 GMT 2014

Powered by FUDForum. Page generated in 0.01696 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software