private object GetComplexExpressionValue(IType expectedType, Expression expression)
{
IEntity tag = GetEntity(expression);
if (EntityType.Type == tag.EntityType)
return GetSystemType(expression);
if (EntityType.Field == tag.EntityType)
{
IField field = (IField)tag;
if (field.IsLiteral)
{
//Scenario:
//IF:
//SomeType.StaticReference = "hamsandwich"
//[RandomAttribute(SomeType.StaticReferenece)]
//THEN:
//field.StaticValue != "hamsandwich"
//field.StaticValue == SomeType.StaticReference
//SO:
//If field.StaticValue is an AST Expression, call GetValue() on it
if (field.StaticValue is Expression)
return GetValue(expectedType, field.StaticValue as Expression);
return field.StaticValue;
}
}
NotImplemented(expression, "Expression value: " + expression);
return null;
}