added a clear test

Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
Christian Dietrich 2021-07-02 11:50:31 +02:00
parent 206b7afb19
commit 8133d0be88

View file

@ -43,6 +43,7 @@ import org.eclipse.xtext.serializer.ISerializer;
import org.eclipse.xtext.service.OperationCanceledManager; import org.eclipse.xtext.service.OperationCanceledManager;
import org.eclipse.xtext.util.IResourceScopeCache; import org.eclipse.xtext.util.IResourceScopeCache;
import org.eclipse.xtext.util.LazyStringInputStream; import org.eclipse.xtext.util.LazyStringInputStream;
import org.eclipse.xtext.util.OnChangeEvictingCache;
import org.eclipse.xtext.util.ReplaceRegion; import org.eclipse.xtext.util.ReplaceRegion;
import org.eclipse.xtext.util.TextRegion; import org.eclipse.xtext.util.TextRegion;
import org.eclipse.xtext.validation.IConcreteSyntaxValidator; import org.eclipse.xtext.validation.IConcreteSyntaxValidator;
@ -296,6 +297,10 @@ public class XtextResource extends ResourceImpl {
EObject newRootASTElement = parseResult.getRootASTElement(); EObject newRootASTElement = parseResult.getRootASTElement();
if (newRootASTElement != null && !containsRootElement(newRootASTElement)) if (newRootASTElement != null && !containsRootElement(newRootASTElement))
getContents().add(0, newRootASTElement); getContents().add(0, newRootASTElement);
IResourceScopeCache cache = getCache();
if (cache instanceof OnChangeEvictingCache) {
((OnChangeEvictingCache) cache).clear(this);
}
reattachModificationTracker(newRootASTElement); reattachModificationTracker(newRootASTElement);
clearErrorsAndWarnings(); clearErrorsAndWarnings();
addSyntaxErrors(); addSyntaxErrors();