Example #1
0
        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);
        }
Example #2
0
        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));
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }