Home » Modeling » TMF (Xtext) » AbstractModelInferrer how to link XExpression XFeatureCall's feature to JvmField that just got adde
| |
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 |
|
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
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
| |
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 |
|
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
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Goto Forum:
Current Time: Fri Apr 26 00:14:40 GMT 2024
Powered by FUDForum. Page generated in 0.03548 seconds
|