Unresolved global references in validation [message #629571] |
Tue, 28 September 2010 18:21 |
Jérôme Fouletier Messages: 39 Registered: September 2010 Location: France |
Member |
|
|
Hello all,
Our XText grammar defines expressions using references linked to an external ecore model. We have implemented an IGlobalScopeProvider for the external model, but are relying on the default linker.
We have defined a type inference class, as well as a validator.
Now, our problem is that, when the expression to be validated contains an operand that is unresolved (i.e. the name does not match any in the external model), the corresponding "getFeature" accessor returns the unresolvable proxy object.
What policy would be recommended for validating rules, where one of the features may be an undefined link?
[Updated on: Tue, 28 September 2010 18:22] Report message to a moderator
|
|
|
Re: Unresolved global references in validation [message #629650 is a reply to message #629571] |
Wed, 29 September 2010 06:36 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
Am 9/28/10 8:21 PM, schrieb Jerome:
> Hello all,
>
> Our XText grammar defines expressions using references linked to an
> external ecore model, that is small enough to be completely loaded at
> runtime.
>
> We have defined a type inference class, as well as a validator.
> Now, our problem is that, when the expression to be validated contains
> an operand that is unresolved (i.e. the name does not match any in the
> external model), the corresponding "getFeature" accessor returns the
> unresolvable proxy object.
>
> We have implemented an IGlobalScopeProvider for the external model, but
> are relying on the default linker.
>
> What policy would be recommended for validating rules, where one of the
> features may be an undefined link?
>
Not sure I understand what you want to achieve.
By default broken links are considered compile-time errors and any
validation rules which are based on unresolved links shouldn't be
triggered (you have to take care of that manually by adding a guard).
Sven
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Re: Unresolved global references in validation [message #629678 is a reply to message #629650] |
Wed, 29 September 2010 08:38 |
Jérôme Fouletier Messages: 39 Registered: September 2010 Location: France |
Member |
|
|
Sven Efftinge wrote on Wed, 29 September 2010 08:36 | Am 9/28/10 8:21 PM, schrieb Jerome:
> ...
Not sure I understand what you want to achieve.
By default broken links are considered compile-time errors and any
validation rules which are based on unresolved links shouldn't be
triggered (you have to take care of that manually by adding a guard).
Sven
|
Yes, thanks for the prompt reply, that actually answered my question. I suppose testing getXXX().eIsProxy() is the right way for implementing the guard? Or are there other subtleties I should be wary of?
[Updated on: Wed, 29 September 2010 08:38] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03155 seconds