public object Evaluate(Context context)
{
object obj = null;
if (this.type == null)
obj = this.expression.Evaluate(context);
object[] parameters = null;
if (this.arguments != null)
{
List<object> values = new List<object>();
foreach (IExpression argument in this.arguments)
values.Add(argument.Evaluate(context));
parameters = values.ToArray();
}
if (this.type != null)
return TypeUtilities.InvokeTypeMember(this.type, this.name, parameters);
if (obj is Type)
return TypeUtilities.InvokeTypeMember((Type)obj, this.name, parameters);
// TODO if undefined, do nothing
if (obj == null)
return null;
return ObjectUtilities.GetValue(obj, this.name, parameters);
}