@Override
public Void visitMethodInvocation(MethodInvocation node) {
SimpleIdentifier name = node.getMethodName();
Element element = name.getBestElement();
if (element instanceof MethodElement || element instanceof PropertyAccessorElement) {
Location location = createLocationFromNode(name);
Relationship relationship;
if (node.getTarget() != null) {
relationship = IndexConstants.IS_INVOKED_BY_QUALIFIED;
} else {
relationship = IndexConstants.IS_INVOKED_BY_UNQUALIFIED;
}
recordRelationship(element, relationship, location);
}
if (element instanceof FunctionElement || element instanceof VariableElement) {
Location location = createLocationFromNode(name);
recordRelationship(element, IndexConstants.IS_INVOKED_BY, location);
}
// name invocation
{
Element nameElement = new NameElementImpl(name.getName());
Location location = createLocationFromNode(name);
Relationship kind = element != null ? IndexConstants.NAME_IS_INVOKED_BY_RESOLVED
: IndexConstants.NAME_IS_INVOKED_BY_UNRESOLVED;
store.recordRelationship(nameElement, kind, location);
}
recordImportElementReferenceWithoutPrefix(name);