public AttributeGen Set(string name, object value) { CheckValue(value); for (Type t = attributeType; t != null; t = t.BaseType) { foreach (IMemberInfo mi in TypeInfo.GetFields(t)) { if (mi.Name == name && !mi.IsStatic) { SetFieldIntl((FieldInfo)mi.Member, value); return(this); } } ApplicableFunction af = OverloadResolver.Resolve(TypeInfo.Filter(TypeInfo.GetProperties(t), name, false, false, false), Operand.EmptyArray); if (af != null) { SetPropertyIntl((PropertyInfo)af.Method.Member, value); return(this); } } throw new MissingMemberException(Properties.Messages.ErrMissingProperty); }
public static Operand New(Type type, params Operand[] args) { ApplicableFunction ctor = OverloadResolver.Resolve(TypeInfo.GetConstructors(type), args); if (ctor == null) { throw new MissingMethodException(Properties.Messages.ErrMissingConstructor); } return(new NewObject(ctor, args)); }
public static ApplicableFunction FindConstructor(Type t, Operand[] args) { ApplicableFunction ctor = OverloadResolver.Resolve(GetConstructors(t), args); if (ctor == null) { throw new MissingMemberException(Properties.Messages.ErrMissingConstructor); } return(ctor); }
public static ApplicableFunction FindMethod(Type t, string name, Operand[] args, bool @static) { for (; t != null; t = t.BaseType) { ApplicableFunction af = OverloadResolver.Resolve(Filter(GetMethods(t), name, false, @static, false), args); if (af != null) { return(af); } } throw new MissingMethodException(Properties.Messages.ErrMissingMethod); }
public static ApplicableFunction FindProperty(Type t, string name, Operand[] indexes, bool @static) { if (name == null) { name = GetDefaultMember(t); } for (; t != null; t = t.BaseType) { ApplicableFunction af = OverloadResolver.Resolve(Filter(GetProperties(t), name, false, @static, false), indexes); if (af != null) { return(af); } } throw new MissingMemberException(Properties.Messages.ErrMissingProperty); }