Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » AbstractModelInferrer how to link XExpression XFeatureCall's feature to JvmField that just got adde
AbstractModelInferrer how to link XExpression XFeatureCall's feature to JvmField that just got adde [message #1715283] Fri, 20 November 2015 23:27 Go to next message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
I'm having a Linker issue (unresolved EMF Proxy, JvmVoid) in an AbstractModelInferrer, a XExpression XFeatureCall's feature to JvmField that just got added does not resolve, what am I doing wrong?

More concretely, imagine org.eclipse.xtext.example.domainmodel, and in DomainmodelJvmModelInferrer after the toField etc. and body = f.body, I'd like to do some.. "processing" (actually I'd like to see which XExpression accesses which JvmField, to do something about it..), so I f.body.eAllContents.filter(XFeatureCall).forEach[... but when you run e.g. org.eclipse.xtext.example.domainmodel.tests.CompilerTest then each featureCall.feature is a JvmVoid: (eProxyURI: MyFile1.dmodel#|*)

I'll upload complete example code which easily illustrates what I'm putting in words above.
Re: AbstractModelInferrer how to link XExpression XFeatureCall's feature to JvmField that just got [message #1715284 is a reply to message #1715283] Fri, 20 November 2015 23:31 Go to previous messageGo to next message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
git clone https://github.com/vorburger/xtext-sandbox.git, run https://github.com/vorburger/xtext-sandbox/blob/master/XbaseDomainmodelXExpression/org.eclipse.xtext.example.domainmodel.tests/src/org/eclipse/xtext/example/domainmodel/tests/CompilerTest.xtend (unchanged from example Wizard), and Console will show several outputs from https://github.com/vorburger/xtext-sandbox/blob/654e0e96e393b2ca99119410fd833bff04d2ef48/XbaseDomainmodelXExpression/org.eclipse.xtext.example.domainmodel/src/org/eclipse/xtext/example/domainmodel/jvmmodel/DomainmodelJvmModelInferrer.xtend#L63 like this, instead of resolved feature = JvmField - what's the trick? Wink Thank You!

featureCall = bar
	class = class org.eclipse.xtext.xbase.impl.XFeatureCallImplCustom
	concreteSyntaxFeatureName = bar
	implicitReceiver = 
	actualReceiver = 
	feature = JvmVoid:  (eProxyURI: file:/tmp/1448061669528-0/1448061669528-0/myProject/src/MyFile1.dmodel#|7)
Re: AbstractModelInferrer how to link XExpression XFeatureCall's feature to JvmField that just got a [message #1715415 is a reply to message #1715283] Mon, 23 November 2015 12:37 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 21/11/2015 00:27, Michael Vorburger wrote:
> I'm having a Linker issue (unresolved EMF Proxy, JvmVoid) in an
> AbstractModelInferrer, a XExpression XFeatureCall's feature to JvmField
> that just got added does not resolve, what am I doing wrong?
>
> More concretely, imagine org.eclipse.xtext.example.domainmodel, and in
> DomainmodelJvmModelInferrer after the toField etc. and body = f.body,
> I'd like to do some.. "processing" (actually I'd like to see which
> XExpression accesses which JvmField, to do something about it..), so I
> f.body.eAllContents.filter(XFeatureCall).forEach[... but when you run
> e.g. org.eclipse.xtext.example.domainmodel.tests.CompilerTest then each
> featureCall.feature is a JvmVoid: (eProxyURI: MyFile1.dmodel#|*)
>
> I'll upload complete example code which easily illustrates what I'm
> putting in words above.

Hi

after you associated the body you can't assume that everything is linked
(namely, scoping). The association will be used later internally by
Xtext to perform scoping and linking.

If you want to check which expressions accesses something I think you
should do that in the validator, using utility classes provided by Xbase
itself (if I remember correctly there is something for cross reference
usage). Of course, it depends on what you need to do with the
information about usage/access).

hope this helps
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: AbstractModelInferrer how to link XExpression XFeatureCall's feature to JvmField that just got a [message #1715895 is a reply to message #1715415] Fri, 27 November 2015 11:46 Go to previous messageGo to next message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
Lorenzo, first of all thank you for taking the time to reply!

> check which expressions accesses (...) should do that in the validator
> depends on what you need to do with the information about usage/access

Unfortunately I actually want to generate code, not just Validate... my idea is for setters of fields using in expressions of other fields to cause recalculation of those fields (eventually with full dependency tracking and loop detection and whiz-bang, yes yes).

There must be some way to do this?
Re: AbstractModelInferrer how to link XExpression XFeatureCall's feature to JvmField that just got a [message #1715938 is a reply to message #1715895] Sat, 28 November 2015 10:45 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 27/11/2015 12:46, Michael Vorburger wrote:
> Lorenzo, first of all thank you for taking the time to reply!
>
>> check which expressions accesses (...) should do that in the validator
>> depends on what you need to do with the information about usage/access
>
> Unfortunately I actually want to generate code, not just Validate... my
> idea is for setters of fields using in expressions of other fields to
> cause recalculation of those fields (eventually with full dependency
> tracking and loop detection and whiz-bang, yes yes).
>
> There must be some way to do this?

Hi

it is not yet clear to me what you're trying to achieve, but if you
really need to do the model for validation after it is linked I think
you can hook into the generation stage, where scoping has already been
performed. For example, with a custom Xbase compiler...

just an idea

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Previous Topic:Xtext build with maven and mixed Xtend/Java projects
Next Topic:cache for all resources
Goto Forum:
  


Current Time: Fri Apr 26 00:14:40 GMT 2024

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

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

Back to the top