зеркало из https://github.com/microsoft/lsif-java.git
fix: Duplicate end events for a document vertex (#93)
This commit is contained in:
Родитель
7da53fb33c
Коммит
5eca06e343
|
@ -54,7 +54,7 @@ public class Repository {
|
|||
|
||||
// Key: documentURI
|
||||
// Value: Document object
|
||||
private Map<String, Document> beginededDocumentMap = new ConcurrentHashMap<>();
|
||||
private Map<String, Document> begunDocumentMap = new ConcurrentHashMap<>();
|
||||
|
||||
// Key: groupId + artifactId
|
||||
// Value: PackageInformation
|
||||
|
@ -86,7 +86,7 @@ public class Repository {
|
|||
targetDocument = service.getVertexBuilder().document(uri);
|
||||
addDocument(targetDocument);
|
||||
LsifEmitter.getInstance().emit(targetDocument);
|
||||
addToBeginededDocuments(targetDocument);
|
||||
addToBegunDocuments(targetDocument);
|
||||
LsifEmitter.getInstance().emit(service.getVertexBuilder().event(Event.EventScope.DOCUMENT,
|
||||
Event.EventKind.BEGIN, targetDocument.getId()));
|
||||
LsifEmitter.getInstance().emit(service.getEdgeBuilder().contains(projVertex, targetDocument));
|
||||
|
@ -153,16 +153,16 @@ public class Repository {
|
|||
return enlistMavenProject(lsif, pomFile);
|
||||
}
|
||||
|
||||
public void addToBeginededDocuments(Document doc) {
|
||||
this.beginededDocumentMap.put(doc.getUri(), doc);
|
||||
public void addToBegunDocuments(Document doc) {
|
||||
this.begunDocumentMap.put(doc.getUri(), doc);
|
||||
}
|
||||
|
||||
public void removeFromBeginededDocuments(String uri) {
|
||||
this.beginededDocumentMap.remove(uri);
|
||||
public void removeFromBegunDocuments(String uri) {
|
||||
this.begunDocumentMap.remove(uri);
|
||||
}
|
||||
|
||||
public ArrayList<Document> getAllBeginededDocuments() {
|
||||
return new ArrayList<>(this.documentMap.values());
|
||||
public ArrayList<Document> getAllBegunDocuments() {
|
||||
return new ArrayList<>(this.begunDocumentMap.values());
|
||||
}
|
||||
|
||||
private void addDocument(Document doc) {
|
||||
|
|
|
@ -166,13 +166,13 @@ public class VisitorUtils {
|
|||
}
|
||||
|
||||
public static void endDocument(LsifService lsif, Document doc) {
|
||||
Repository.getInstance().removeFromBeginededDocuments(doc.getUri());
|
||||
Repository.getInstance().removeFromBegunDocuments(doc.getUri());
|
||||
LsifEmitter.getInstance()
|
||||
.emit(lsif.getVertexBuilder().event(Event.EventScope.DOCUMENT, Event.EventKind.END, doc.getId()));
|
||||
}
|
||||
|
||||
public static void endAllDocument(LsifService lsif) {
|
||||
for (Document doc : Repository.getInstance().getAllBeginededDocuments()) {
|
||||
for (Document doc : Repository.getInstance().getAllBegunDocuments()) {
|
||||
endDocument(lsif, doc);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче