Exemplo n.º 1
0
        public override ILProperty GetProperty(string propertyName)
        {
            if (((IBuilder)this.Coding).IsBuild)
            {
                throw new CodingException("Metodun tanımlandığı tip derlenmiş. Derlenmiş metotların gövdesi yeniden yazılamaz.");
            }
            if (propertyName == null)
            {
                throw new ArgumentNullException("propertyName");
            }

            ILPropertyBuilder builder = this.Coding.CurrentMethod.ILTypeBuilder.FindPropertyBuilder(propertyName);

            if (builder == null)
            {
                return(this.Coding.Base.GetProperty(propertyName));
            }
            if (builder.IsStatic)
            {
                throw new MemberNotFoundException("Hedef obje, çağrılmak istenen özelliği içermiyor veya özellik statik.");
            }
            else
            {
                return(new ILProperty(this.Coding, this, builder));
            }
        }
Exemplo n.º 2
0
        internal ILProperty(ILCoder coding, ILVariable instance, ILPropertyBuilder propertyBuilder)
        {
            this.Coding            = coding;
            this._instance         = instance;
            this._getMethodBuilder = propertyBuilder.GetMethod;
            this._setMethodBuilder = propertyBuilder.SetMethod;
            this.PropertyType      = propertyBuilder.PropertyType;

            this.GetModifier = propertyBuilder.GetMethod == null ? AccessModifiers.Private : propertyBuilder.GetModifier;
            this.SetModifier = propertyBuilder.SetMethod == null ? AccessModifiers.Private : propertyBuilder.SetModifier;
        }
Exemplo n.º 3
0
        public ILPropertyBuilder DefineProperty(string propertyName, Type propertyType, bool isStatic)
        {
            if (this._isBuild)
            {
                throw new DefinitionException("Tip daha önce derlenmiş. Derlenmiş tipler üzerinde yeni üye eklemesi yapılamaz.");
            }

            if (this._fields.ContainsKey(propertyName))
            {
                throw new DefinitionException(propertyName + " isimli özellik daha önce tanımlanmış.");
            }

            ILPropertyBuilder builder = new ILPropertyBuilder(this, propertyName, propertyType, isStatic);

            this._properties.Add(propertyName, builder);
            return(builder);
        }
Exemplo n.º 4
0
        public ILPropertyBuilder DefineOverrideProperty(PropertyInfo baseProperty)
        {
            if (this._isBuild)
            {
                throw new DefinitionException("Tip daha önce derlenmiş. Derlenmiş tipler üzerinde yeni üye eklemesi yapılamaz.");
            }

            if (baseProperty.GetGetMethod() == null ? false : baseProperty.GetGetMethod().IsStatic || baseProperty.GetSetMethod() == null ? false : baseProperty.GetSetMethod().IsStatic)
            {
                throw new BuildException("Static özellikler geçersiz kılınamaz.");
            }

            if (this._fields.ContainsKey(baseProperty.Name))
            {
                throw new BuildException(baseProperty.Name + " isimli özellik daha önce tanımlanmış.");
            }

            ILPropertyBuilder builder = new ILPropertyBuilder(this, baseProperty);

            this._properties.Add(baseProperty.Name, builder);
            return(builder);
        }