Element element) {
if (element instanceof PropertyAccessorElement) {
//
// This is an invocation of the call method defined on the value returned by the getter.
//
FunctionType getterType = ((PropertyAccessorElement) element).getType();
if (getterType != null) {
Type getterReturnType = getterType.getReturnType();
if (getterReturnType instanceof InterfaceType) {
MethodElement callMethod = ((InterfaceType) getterReturnType).lookUpMethod(
FunctionElement.CALL_METHOD_NAME,
definingLibrary);
if (callMethod != null) {
return resolveArgumentsToFunction(false, argumentList, callMethod);
}
} else if (getterReturnType instanceof FunctionType) {
ParameterElement[] parameters = ((FunctionType) getterReturnType).getParameters();
return resolveArgumentsToParameters(false, argumentList, parameters);
}
}
} else if (element instanceof ExecutableElement) {
return resolveArgumentsToFunction(false, argumentList, (ExecutableElement) element);
} else if (element instanceof VariableElement) {
VariableElement variable = (VariableElement) element;
Type type = promoteManager.getStaticType(variable);
if (type instanceof FunctionType) {
FunctionType functionType = (FunctionType) type;
ParameterElement[] parameters = functionType.getParameters();
return resolveArgumentsToParameters(false, argumentList, parameters);
} else if (type instanceof InterfaceType) {
// "call" invocation
MethodElement callMethod = ((InterfaceType) type).lookUpMethod(
FunctionElement.CALL_METHOD_NAME,