Problems with scoping after migrating to xtext 2.0 [message #715424] |
Sat, 13 August 2011 23:43 |
|
Hi anybody,
I have a very strange behaviour in my scoping since migrated to xtext 2.0
There is a method getLocalElementsByEObject(Eobject, URI) in the class SimpleScope, which is called.
This calls getAllLocalElements() in the first line.
Afterwards in the filtermethod canBeFoundByNameAndShadowingKey() the method getLocalElementsByName() is called.
In my setup the first methodcall of getAllLocalElements() clears the complete iterator, so it's empty if the second method is called. This leads to non finding the searched element.
Is this a common bug or can you give me a hint why iterator-elements are removed? What's wrong?
Best regards
Markus
|
|
|
|
|
|
Re: Problems with scoping after migrating to xtext 2.0 [message #716272 is a reply to message #715660] |
Tue, 16 August 2011 20:40 |
|
Hi Christian,
I got it.... solved the bug, but don't exactly know why (Extracting a example is not that easy, sorry)....
Iterable<IEObjectDescription> concat = Iterables.concat(Iterables.transform(new SuperDomainIterable(dom),
new Function<Domain, Iterable<IEObjectDescription>>() {
public Iterable<IEObjectDescription> apply(Domain from) {
Iterable<EObject> allContents2 = allContents(from, filter);
for (EObject nextObject: allContents2)
LOGGER.info("nextObject: " + nextObject.toString());
return transform(allContents2, new QualifiedNameFunction(from));
}
}));
This was the Iterable, the scope was filled with.
I added the following lines:
//In SimpleScope
ArrayList <IEObjectDescription> list = new ArrayList<IEObjectDescription>();
Iterator <IEObjectDescription> it = concat.iterator();
while (it.hasNext()) {
list.add(it.next());
}
and gave the list to the simplescope. Now it doesn't disappear anymore and the reference is resolvable. I can iterate multiple times now.
Perhaps you can give me a hint, I'm nosy what's the real problem, nevertheless I have a solution for me
Best regards
Markus
[Updated on: Tue, 16 August 2011 20:40] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04889 seconds