Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Infer types for inferred jvm model
Infer types for inferred jvm model [message #902481] Fri, 17 August 2012 21:05 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 672
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

My DSL is a flow language where nodes are connected through typed ports.
A node may contain an XExpression and a Java operation is inferred and
generated with suitable parameter and return types.

Now I want as much as possible of the type information to be optional,
i.e. inferred, too, like Xbase does already. Ideally, I would like to
infer types through the whole graph, but I start with the return types
since they only require local information. When the inferrer infers a
method and lacks the return type, I call an injected ITypeProvider's
getType method on the body expression. However, it seems this is done
too early before the expressions are properly linked, because
getType(exprs) always returns null and in the debugger I see lots of
proxies.

So the question is: At what point in the infer/link process can I infer
and add the missing type information, e.g. return and parameter types,
but possibly also other types in the inferred jvm model?

Regards,

Hallvard

BTW, the use of the inferrer seems much improved in 2.3, thank you!
Re: Infer types for inferred jvm model [message #902484 is a reply to message #902481] Fri, 17 August 2012 21:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
Hi,

do you call initializeLater in your inferrer

acceptor.accept(
			entity.toClass( entity.fullyQualifiedName )
		).initializeLater [
                ...
                ]


~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Infer types for inferred jvm model [message #902490 is a reply to message #902484] Fri, 17 August 2012 21:50 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 672
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 17.08.12 14.11, Christian Dietrich wrote:
> Hi,
>
> do you call initializeLater in your inferrer
>
>
> acceptor.accept(
> entity.toClass( entity.fullyQualifiedName )
> ).initializeLater [
> ...
> ]

Yes, it's the same whether it's called in the toClass init-procedure or
initializeLater's.

I see that it works for a String literal, so I think it's type
information e.g. when using extension methods that's the problem.

Note that I in general would like to traverse the whole model and infer
all missing types in a certain order under my control, so I need to be
able to run the inference at an appropriate point.

Hallvard
Previous Topic:How @Inject ParseHelper<> is supposed to work ?
Next Topic:Sharing experience of writing grammar in Xtext
Goto Forum:
  


Current Time: Thu Dec 03 23:44:36 GMT 2020

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

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

Back to the top