public static string EvaluateMethodCoupling(InvocationExpression expression, MethodProperties meth)
{
Console.WriteLine(expression.ToString());
meth.EfferentCoupling++;
StringBuilder calleeName = new StringBuilder();
List<string> paramList = new List<string>();
MethodProperties methCallee = null;
lock(coupleLock)
{
if(expression.TargetObject is MemberReferenceExpression) {
calleeName.Append(ExtractCalleeFullName((MemberReferenceExpression)(expression.TargetObject), meth));
paramList = ExtractParamList(expression, meth);
try {
methCallee = ComplexityMetrics.ProjProp.GetMethodReference(calleeName.ToString(), paramList);
methCallee.AfferentCoupling++;
} catch (Exception e) {
Console.WriteLine(e.ToString());
}
} else if (expression.TargetObject is IdentifierExpression) {
calleeName.Append(((IdentifierExpression)expression.TargetObject).Identifier);
paramList = ExtractParamList(expression, meth);
try {
Console.WriteLine(calleeName.ToString());
methCallee = ComplexityMetrics.ProjProp.GetMethodReference(calleeName.ToString(), paramList);
methCallee.AfferentCoupling++;
} catch (Exception e) {
Console.WriteLine(e.ToString());
}
}
}
return methCallee.Method.ReturnType.FullName;
}