private void parseMethod(Indexer newIndexer, URI sourceUri, ClassNode parent, Map<String, Location> classes,
Map<String, FieldNode> classFields, MethodNode method) {
SymbolInformation methodSymbol =
createSymbolInformation(method.getName(), SymbolKind.Method,
GroovyLocations.createLocation(sourceUri, method), Optional.of(parent.getName()));
newIndexer.addSymbol(sourceUri, methodSymbol);
method.getVariableScope().getDeclaredVariables().values().forEach(variable -> {
SymbolInformation variableSymbol = getVariableSymbolInformation(method.getName(), sourceUri, variable);
newIndexer.addSymbol(sourceUri, variableSymbol);
if (classes.containsKey(variable.getType().getName())) {
newIndexer.addReference(classes.get(variable.getType().getName()),
GroovyLocations.createLocation(sourceUri, variable.getType()));
}
});
if (classes.containsKey(method.getReturnType().getName())) {
newIndexer.addReference(classes.get(method.getReturnType().getName()),
GroovyLocations.createLocation(sourceUri, method.getReturnType()));
}
if (Ranges.isValid(methodSymbol.getLocation().getRange())) {
if (method.getCode() instanceof BlockStatement) {
BlockStatement blockStatement = (BlockStatement) method.getCode();
blockStatement.visit(new MethodVisitor(newIndexer, sourceUri, parent, classes, classFields,
Optional.of(method), workspaceUriSupplier));
}
}
}