|
Re: Access a referenced JvmGenericType in the JvmModelInferrer [message #1231671 is a reply to message #1231289] |
Wed, 15 January 2014 07:19 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
You cannot resolve any crossreferences when 'preIndexingPhase=true'.
This is because you run into a chicken and egg problem when you try to
look up types in order to contribute new types because you will change
the scope (the types available) and that would cause non-deterministic
behavior.
I thinl you'll have to reconsider your design.
Sven
Am 14/01/14 10:22, schrieb Cioran Naroic:
> Hello everyone,
>
> Here is my test grammar:
>
> grammar some.grammar.example with org.eclipse.xtext.xbase.Xbase
>
> generate example "http:/www.some.com/grammar/example/"
>
> import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes
>
> ModelRoot:
> (elements += ElementDecl)*
> ;
>
> ElementDecl:
> 'element' name = ValidID '{'
> referenced += ReferencedDecl*
> '}'
> ;
>
> ReferencedDecl:
> 'referenced' type = [jvmTypes::JvmGenericType | QualifiedName]
> ;
>
>
> With an example:
>
> element X {
> referenced my.package.ClassX
> }
>
>
> I would like to "browse" the declared operations, fields etc. of the
> referenced JvmGenericType in my implementation of JvmModelInferrer (I
> need to generate specific classes depending on the content of the
> referenced type).
>
> I have no problem doing that in a "initializeLater" section, but all the
> fields of the referenced type are empty or null when I try to browse
> them outside an "initializeLater", and printing the type itself gives me:
>
> "elem.type=JvmGenericType: (eProxyURI:
> platform:/resource/some.grammar.example/src/some.grammar.example/test.example#xtextLink_::0.1.0.3.1::0::/2)
>
>
>
> The problem is I can't do my browsing inside an "initializeLater"
> because I need to pass new classes to the acceptor depending on it, and
> I can't do that in this phase.
>
> Do you have any idea of how I could browse the JvmGenericType in an
> infer(...) method? That is, resolving the proxy, changing something in
> my grammar or something like that?
>
> Thank you,
>
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Powered by
FUDForum. Page generated in 0.03285 seconds