Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
break;
case VertexLabels.document:
this.insertDocument(element);
break;
case VertexLabels.packageInformation:
this.insertPackageInformation(element);
break;
case VertexLabels.range:
this.insertRange(element);
break;
default:
this.insertVertex(element);
}
} else {
switch(element.label) {
case EdgeLabels.contains:
this.insertContains(element);
break;
case EdgeLabels.item:
this.insertItem(element);
break;
default:
this.insertEdge(element);
}
}
}
export const create: Create = (writer: Writer, idGenerator: () => Id): Emitter => {
let vertices: Map;
const labelMap: Map = new Map([
[EdgeLabels.item, 'item'],
[EdgeLabels.contains, 'contains'],
[EdgeLabels.next, 'next'],
[EdgeLabels.textDocument_documentSymbol, 'textDocument.documentSymbol'],
[EdgeLabels.textDocument_foldingRange, 'textDocument.foldingRange'],
[EdgeLabels.textDocument_diagnostic, 'textDocument.diagnostic'],
[EdgeLabels.textDocument_documentLink, 'textDocument.documentLink'],
[EdgeLabels.textDocument_definition, 'textDocument.definition'],
[EdgeLabels.textDocument_typeDefinition, 'textDocument.typeDefinition'],
[EdgeLabels.textDocument_hover, 'textDocument.hover'],
[EdgeLabels.textDocument_references, 'textDocument.references'],
[EdgeLabels.textDocument_implementation, 'textDocument.implementation'],
]);
return {
start: () => {
vertices = new Map();
},
emit: (element: Vertex | Edge) => {
case EdgeLabels.textDocument_hover:
this.handleHoverEdge(element);
break;
case EdgeLabels.textDocument_declaration:
this.handleDeclarationEdge(element);
break;
case EdgeLabels.textDocument_definition:
this.handleDefinitionEdge(element);
break;
case EdgeLabels.textDocument_references:
this.handleReferenceEdge(element);
break;
case EdgeLabels.item:
this.handleItemEdge(element);
break;
case EdgeLabels.contains:
this.handleContains(element);
break;
}
}
}
export const create: Create = (idGenerator: () => Id): Emitter => {
let vertices: Map;
const labelMap: Map = new Map([
[EdgeLabels.item, 'item'],
[EdgeLabels.contains, 'contains'],
[EdgeLabels.refersTo, 'refersTo'],
[EdgeLabels.textDocument_documentSymbol, 'textDocument.documentSymbol'],
[EdgeLabels.textDocument_foldingRange, 'textDocument.foldingRange'],
[EdgeLabels.textDocument_diagnostic, 'textDocument.diagnostic'],
[EdgeLabels.textDocument_documentLink, 'textDocument.documentLink'],
[EdgeLabels.textDocument_definition, 'textDocument.definition'],
[EdgeLabels.textDocument_typeDefinition, 'textDocument.typeDefinition'],
[EdgeLabels.textDocument_hover, 'textDocument.hover'],
[EdgeLabels.textDocument_references, 'textDocument.references'],
[EdgeLabels.textDocument_implementation, 'textDocument.implementation'],
]);
return {
start: () => {
vertices = new Map();
},
emit: (element: Vertex | Edge) => {
private processEdge(edge: Edge): void {
let from: Vertex | undefined = this.vertices.all.get(edge.outV);
let to: Vertex | undefined = this.vertices.all.get(edge.inV);
if (from === void 0) {
throw new Error(`No vertex found for Id ${edge.outV}`);
}
if (to === void 0) {
throw new Error(`No vertex found for Id ${edge.inV}`);
}
let values: any[] | undefined;
switch (edge.label) {
case EdgeLabels.contains:
values = this.out.contains.get(from.id);
if (values === void 0) {
values = [ to as any ];
this.out.contains.set(from.id, values);
} else {
values.push(to);
}
this.in.contains.set(to.id, from as any);
break;
case EdgeLabels.item:
values = this.out.item.get(from.id);
let itemTarget: ItemTarget | undefined;
switch (edge.property) {
case ItemEdgeProperties.references:
itemTarget = { type: edge.property, range: to as Range };
break;