Пример #1
0
        public override void AssignFrom(ILData ilValue)
        {
            if (((IBuilder)this.Coding).IsBuild)
            {
                throw new CodingException("Metodun tanımlandığı tip derlenmiş. Derlenmiş metotların gövdesi yeniden yazılamaz.");
            }
            if (ilValue == null)
            {
                throw new ArgumentNullException("ilValue");
            }

            if (this.FieldInfo.FieldType.IsAssignableFrom(ilValue.ILType))
            {
                if (this.IsStatic)
                {
                    ((IILPusher)ilValue).Push();
                    this.Coding.Generator.Emit(OpCodes.Stsfld, this.FieldInfo);
                }
                else
                {
                    ((IILPusher)this._instance).Push();
                    ((IILPusher)ilValue).Push();
                    this.Coding.Generator.Emit(OpCodes.Stfld, this.FieldInfo);
                }
            }
            else
            {
                throw new TypeConvertException("Alanın türü, atanmak istenen objenin türünde değildi. Dönüştürme gerekli.");
            }
        }
Пример #2
0
        public void Set(ILData ilValue)
        {
            if (((IBuilder)this.Coding).IsBuild)
            {
                throw new CodingException("Metodun tanımlandığı tip derlenmiş. Derlenmiş metotların gövdesi yeniden yazılamaz.");
            }
            if (ilValue == null)
            {
                throw new ArgumentNullException("ilValue");
            }

            if (this._setMethod == null && this._setMethodBuilder == null)
            {
                throw new MethodNotFoundException("Özellik, set metodunu içermiyor.");
            }
            else if (ilValue.ILType != this.PropertyType)
            {
                throw new TypeConvertException("Atanan tür ile özelliğin türü uyumsuz.");
            }
            else
            {
                if (this._setMethod == null)
                {
                    ((IILPusher) new ILLazyInvoke(this.Coding, this._instance, this._setMethodBuilder, null, new ILData[] { ilValue })).Push();
                }
                else
                {
                    ((IILPusher) new ILLazyInvoke(this.Coding, this._instance, this._setMethod, null, new ILData[] { ilValue })).Push();
                }
            }
        }
Пример #3
0
        public void StoreElement(ILData index, ILData ilObj)
        {
            if (((IBuilder)this.Coding).IsBuild)
            {
                throw new CodingException("Metodun tanımlandığı tip derlenmiş. Derlenmiş metotların gövdesi yeniden yazılamaz.");
            }
            if (ilObj == null)
            {
                throw new ArgumentNullException("ilObj");
            }
            if (index == null)
            {
                throw new ArgumentNullException("index");
            }

            if (this.ILType.IsArray)
            {
                if (index.ILType == typeof(int))
                {
                    this.Push();
                    ((IILPusher)ilObj).Push();
                    this.Generator.Emit(OpCodes.Box, ilObj.ILType);
                    ((IILPusher)index).Push();
                    this.Generator.Emit(OpCodes.Call, ILVariable._setArrayValue);
                }
                else
                {
                    throw new CodingException("İndis değerinin türü System.Int32 olmalı.");
                }
            }
            else
            {
                throw new CodingException("Obje bir dizi tipinde değildi.");
            }
        }
Пример #4
0
        public ILLazy LoadElement(ILData index)
        {
            if (((IBuilder)this.Coding).IsBuild)
            {
                throw new CodingException("Metodun tanımlandığı tip derlenmiş. Derlenmiş metotların gövdesi yeniden yazılamaz.");
            }
            if (index == null)
            {
                throw new ArgumentNullException("index");
            }

            if (this.ILType.IsArray)
            {
                if (index.ILType == typeof(int))
                {
                    return(new ILLazyLoadElement(this.Coding, this, index));
                }
                else
                {
                    throw new CodingException("İndis değerinin türü System.Int32 olmalı.");
                }
            }
            else
            {
                throw new CodingException("Obje bir dizi tipinde değildi.");
            }
        }
Пример #5
0
 public override void AssignFrom(ILData ilValue)
 {
     if (((IBuilder)this.Coding).IsBuild)
     {
         throw new CodingException("Metodun tanımlandığı tip derlenmiş. Derlenmiş metotların gövdesi yeniden yazılamaz.");
     }
     throw new CodingException("This işaretçisine atama yapılamaz.");
 }
Пример #6
0
        public void ElseIf(ILData comparer)
        {
            this.Generator.Emit(OpCodes.Ldloc, this._localComparerResult);
            this.Generator.Emit(OpCodes.Brtrue_S, this._endIf);
            Block thisBlock = this.getNewBlock(comparer);
            Block lastBlock = this._blocks[thisBlock.BlockNo - 1];

            this.Generator.MarkLabel(lastBlock.EndBlock);
            ((IILPusher)comparer).Push();
            this.Generator.Emit(OpCodes.Brfalse_S, thisBlock.EndBlock);
            this.Generator.Emit(OpCodes.Ldc_I4_1);
            this.Generator.Emit(OpCodes.Stloc, this._localComparerResult);
        }
Пример #7
0
        public ILLazy Equals(ILData ilValue)
        {
            if (((IBuilder)this.Coding).IsBuild)
            {
                throw new CodingException("Metodun tanımlandığı tip derlenmiş. Derlenmiş metotların gövdesi yeniden yazılamaz.");
            }
            if (ilValue == null)
            {
                throw new ArgumentNullException("ilValue");
            }
            ILData box = this.Coding.Box(ilValue);

            return(this.Coding.Invoke(ILVariable._equals, null, new ILData[] { this, box }));
        }
Пример #8
0
        private Block getNewBlock(ILData comparer)
        {
            if (comparer.ILType != typeof(bool))
            {
                throw new InvalidOperationException("Comparer type must be boolean.");
            }

            Block block = new Block {
                BlockNo = this._currentBlock, Comparer = comparer, EndBlock = this.Generator.DefineLabel()
            };

            this._blocks.Add(block);
            this._currentBlock++;
            return(block);
        }
Пример #9
0
        public override void AssignFrom(ILData ilValue)
        {
            if (((IBuilder)this.Coding).IsBuild)
            {
                throw new CodingException("Metodun tanımlandığı tip derlenmiş. Derlenmiş metotların gövdesi yeniden yazılamaz.");
            }
            if (ilValue == null)
            {
                throw new ArgumentNullException("ilValue.");
            }
            if (!this.ILType.IsAssignableFrom(ilValue.ILType))
            {
                throw new TypeConvertException("Alanın türü, atanmak istenen objenin türünde değildi. Dönüştürme gerekli.");
            }

            ((IILPusher)ilValue).Push();
            base.Generator.Emit(OpCodes.Stloc, this.EmitLocal);
        }
Пример #10
0
        internal ILIfStatement(ILCoder coding, ILData comparer)
        {
            this.Coding                = coding;
            this.Generator             = coding.Generator;
            this.OuterIfStatement      = this.Coding.CurrentIfBlock;
            this.Coding.CurrentIfBlock = this;
            this._blocks               = new List <Block>();
            this._endIf                = this.Generator.DefineLabel();
            this._localComparerResult  = this.Generator.DeclareLocal(typeof(bool));
            this.Generator.Emit(OpCodes.Ldc_I4_0);
            this.Generator.Emit(OpCodes.Stloc, this._localComparerResult);

            Block thisBlock = this.getNewBlock(comparer);

            ((IILPusher)comparer).Push();
            this.Generator.Emit(OpCodes.Brfalse_S, thisBlock.EndBlock);
            this.Generator.Emit(OpCodes.Ldc_I4_1);
            this.Generator.Emit(OpCodes.Stloc, this._localComparerResult);
        }
Пример #11
0
 public void RunBlock(ILData ifTrue)
 {
     ((IILPusher)ifTrue).Push();
     this.Generator.Emit(OpCodes.Brtrue_S, this._beginLabel);
     this.Generator.MarkLabel(this._continueLabel);
 }
Пример #12
0
 public override void AssignFrom(ILData ilValue)
 {
     this._variable.AssignFrom(ilValue);
 }
Пример #13
0
 public abstract void AssignFrom(ILData ilValue);