Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XReturnExpression type deduction in inferrer(type deduction)
XReturnExpression type deduction in inferrer [message #1782013] Fri, 16 February 2018 00:44 Go to next message
Amit Yadav is currently offline Amit YadavFriend
Messages: 28
Registered: June 2017
Junior Member
Hello,

My grammar is using Xbase:XReturnExpression and I need to deduce the Java Type of the XReturnExpression during the code generation part (inferrer) ?

Is there a easy way to do this ?

Thank You,

Amit
Re: XReturnExpression type deduction in inferrer [message #1782022 is a reply to message #1782013] Fri, 16 February 2018 05:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
Can you be more explicit
In your question

Did you have a look at the domainmodel sample


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XReturnExpression type deduction in inferrer [message #1782038 is a reply to message #1782022] Fri, 16 February 2018 12:01 Go to previous messageGo to next message
Amit Yadav is currently offline Amit YadavFriend
Messages: 28
Registered: June 2017
Junior Member
Here is what I am trying to do with Greetings model as an example

Model:
greetings+=Greeting*;

Greeting:
'Hello' name=ID '!' body=XBlockExpression;


What I need to generate is an interface
e.g. public interface Request<type> { .... }

Now what I need to do is find the return statement in the Greetings.body and deduce the type of the thing being returned and use that as the parameter for the Request<> interface.

I tried using a IBatchTypeResolver in my inferrer but that does not work.
Re: XReturnExpression type deduction in inferrer [message #1782040 is a reply to message #1782038] Fri, 16 February 2018 12:10 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
i dont understand. have a look how the domain model example does it

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:createSAXParseException on Windows
Next Topic:Reuse Java Code of Inferred Xbase in Another IGenerator
Goto Forum:
  


Current Time: Wed Sep 19 03:23:32 GMT 2018

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

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

Back to the top