Context-specific scopeFor method dispatched without entering IScopeProvider.getScope [message #1863849] |
Fri, 01 March 2024 05:19  |
Eclipse User |
|
|
|
Hello,
I have implemented a custom scope provider for my DSL.
In a nutshell:
@InjectLogger
Logger logger;
@Override
IScope getScope(EObject context, EReference ref) {
logger.info("Providing scope for " + context);
if (context instanceof SpecificObject1) {
// Dispatch type-specific scopeFor
logger.info("Dispatching scoper for SpecificObject1");
scopeFor(context, ref);
}
if (context instanceof SpecificObject2) {
// Dispatch type-specific scopeFor
}
// ...
// If none of the if blocks match, use the default scope provider
super.getScope(context, ref);
}
// ...
dispatch IScope scopeFor(SpecificObject1 context, EReference ref) {
// Provide special scope for specific object
// val scope = ...
logger.info("Returning custom scope for SpecificObject1 instance");
return scope;
}
Now, I have a situation where the scopeFor method for SpecificObject1 is dispatched without ever entering the getScope method defined by the IScopeProvider interface. This has become evident to me due to the missing log message, to be more specific, there is a case where "Returning custom scope for SpecificObject1 instance" is printed, but "Dispatching scoper for SpecificObject1" doesn't show up at all.
How is this possible? I have thought of the getScope method of the IScopeProvider interface as the "entry point" for all scoping.
Thanks in advance and regards
K.
[Updated on: Fri, 01 March 2024 06:53] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04132 seconds