Example #1
0
        /// <summary>
        ///     <see cref="AssignOperand"/> 를 구현하는 Emit Byte 코드를 씁니다.
        /// </summary>
        /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
        /// <exception cref="NotSupportedException">
        ///		대입 연산을 좌측 선언이 메서드인 경우 발생하는 예외입니다.
        /// </exception>
        public override void WriteEmit(ICodeLambda codeLambda)
        {
            if (left is LocalOperand)
            {
                this.IL.Emit(OpCodes.Nop);

                var leftLocal     = (LocalOperand)left;
                var rightTypeCode = Type.GetTypeCode(right.GetType());

                if (rightTypeCode == TypeCode.String)
                {
                    this.IL.Emit(OpCodes.Ldstr, (string)right);
                }
                else
                {
                    var opcode = mapping.GetMappingValue((int)right);

                    if (opcode.OperandType == OperandType.InlineNone)
                    {
                        this.IL.Emit(opcode);
                    }
                    else
                    {
                        this.IL.Emit(opcode, (int)right);
                    }
                }

                this.IL.Emit(OpCodes.Stloc, leftLocal.Value);
                //this.IL.Emit(OpCodes.Nop);
            }
            else if (left is FieldOperand)
            {
                this.IL.Emit(OpCodes.Nop);

                var leftLocal     = (FieldOperand)left;
                var rightTypeCode = Type.GetTypeCode(right.GetType());

                if (rightTypeCode == TypeCode.String)
                {
                    this.IL.Emit(OpCodes.Ldarg_0);
                    this.IL.Emit(OpCodes.Ldstr, (string)right);
                    this.IL.Emit(OpCodes.Stfld, leftLocal.Value);
                }
                else
                {
                    throw new NotSupportedException("FieldOperand/Int");
                    //var opcode = mapping.GetMappingValue((int)right);

                    //if (opcode.OperandType == OperandType.InlineNone) this.IL.Emit(opcode);
                    //else this.IL.Emit(opcode, (int)right);
                }
            }
            else if (left is MethodOperand)
            {
                throw new NotSupportedException("MethodOperand");
            }
        }
Example #2
0
        /// <summary>
        ///     Emit Byte코드를 읽습니다.
        /// </summary>
        /// <param name="codeLambda">	<see cref="ICodeLambda"/> 를 구현하는 구현부 코드입니다. </param>
        public override void ReadEmit(ICodeLambda codeLambda)
        {
            // Field 선언시 ILGenerator 상태가 없기 때문에, FieldOperand ReadEmit 호출 시에 IL 넘겨줌
            if (this.IL == null)
            {
                this.IL = codeLambda.IL;
            }

            this.IL.Emit(OpCodes.Ldarg_0);
            this.IL.Emit(OpCodes.Ldfld, this.Value);
        }
Example #3
0
 /// <summary>	
 /// 	Emit Byte 코드를 씁니다. 
 /// </summary>
 /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
 public override void WriteEmit(ICodeLambda codeLambda)
 {
     if (typeLambda.MethodAccessor.IsStatic || this.methodInfo.IsStatic)
     {
         this.WriteEmitOfStaticMethod(codeLambda.IL);
     }
     else
     {
         this.WriteEmitOfInstanceMethod(codeLambda.IL);
     }
 }
Example #4
0
 /// <summary>
 ///     Emit Byte 코드를 씁니다.
 /// </summary>
 /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
 public override void WriteEmit(ICodeLambda codeLambda)
 {
     if (typeLambda.MethodAccessor.IsStatic || this.methodInfo.IsStatic)
     {
         this.WriteEmitOfStaticMethod(codeLambda.IL);
     }
     else
     {
         this.WriteEmitOfInstanceMethod(codeLambda.IL);
     }
 }
Example #5
0
        /// <summary>	
        /// 	<see cref="AssignOperand"/> 를 구현하는 Emit Byte 코드를 씁니다. 
        /// </summary>
        /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
        /// <exception cref="NotSupportedException">
        ///		대입 연산을 좌측 선언이 메서드인 경우 발생하는 예외입니다.
        /// </exception>
        public override void WriteEmit(ICodeLambda codeLambda)
        {
            if (left is LocalOperand)
            {
                this.IL.Emit(OpCodes.Nop);

                var leftLocal = (LocalOperand)left;
                var rightTypeCode = Type.GetTypeCode(right.GetType());

                if (rightTypeCode == TypeCode.String)
                {
                    this.IL.Emit(OpCodes.Ldstr, (string)right);
                }
                else
                {
                    var opcode = mapping.GetMappingValue((int)right);

                    if (opcode.OperandType == OperandType.InlineNone) this.IL.Emit(opcode);
                    else this.IL.Emit(opcode, (int)right);
                }

                this.IL.Emit(OpCodes.Stloc, leftLocal.Value);
                //this.IL.Emit(OpCodes.Nop);
            }
            else if (left is FieldOperand)
            {
                this.IL.Emit(OpCodes.Nop);

                var leftLocal = (FieldOperand)left;
                var rightTypeCode = Type.GetTypeCode(right.GetType());

                if (rightTypeCode == TypeCode.String)
                {
                    this.IL.Emit(OpCodes.Ldarg_0);
                    this.IL.Emit(OpCodes.Ldstr, (string)right);
                    this.IL.Emit(OpCodes.Stfld, leftLocal.Value);
                }
                else
                {
                    throw new NotSupportedException("FieldOperand/Int");
                    //var opcode = mapping.GetMappingValue((int)right);

                    //if (opcode.OperandType == OperandType.InlineNone) this.IL.Emit(opcode);
                    //else this.IL.Emit(opcode, (int)right);
                }
            }
            else if (left is MethodOperand)
            {
                throw new NotSupportedException("MethodOperand");
            }
        }
Example #6
0
        /// <summary>
        ///     <see cref="AssignOperand"/> 를 구현하는 코드의 Emit Byte 코드를 씁니다.
        /// </summary>
        /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
        public override void WriteEmit(ICodeLambda codeLambda)
        {
            if (right is LocalOperand)
            {
                var leftLocal  = (LocalOperand)left;
                var rightLocal = (LocalOperand)right;

                if (rightLocal.Value.LocalType.IsPrimitive == true)
                {
                    //OpCode opcode = opcodeI4Mapping.GetMappingValue(local.Value.3)
                    IL.Emit(OpCodes.Ldloc, rightLocal.Value);
                    IL.Emit(OpCodes.Stloc, leftLocal.Value);
                }
            }
            else if (right is FieldOperand)
            {
            }
            else if (right is MethodOperand)
            {
            }
        }
Example #7
0
        /// <summary>	
        /// 	<see cref="AssignOperand"/> 를 구현하는 코드의 Emit Byte 코드를 씁니다. 
        /// </summary>
        /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
        public override void WriteEmit(ICodeLambda codeLambda)
        {
            if (right is LocalOperand)
            {
                var leftLocal = (LocalOperand)left;
                var rightLocal = (LocalOperand)right;

                if (rightLocal.Value.LocalType.IsPrimitive == true)
                {
                    //OpCode opcode = opcodeI4Mapping.GetMappingValue(local.Value.3)
                    IL.Emit(OpCodes.Ldloc, rightLocal.Value);
                    IL.Emit(OpCodes.Stloc, leftLocal.Value);
                }

            }
            else if (right is FieldOperand)
            {
            }
            else if (right is MethodOperand)
            {
            }
        }
Example #8
0
 /// <summary>
 ///     /Emit Byte 코드를 씁니다.
 /// </summary>
 /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
 public override void WriteEmit(ICodeLambda codeLambda)
 {
     this.fieldBuilder = fieldBuilder = new FieldBuilderExtension(null, this.typeLambda.TypeBuilder)
                                        .CreateField(criteriaMetadataInfo.Name, criteriaMetadataInfo.Type, this.typeLambda.FieldAccessor.FieldAttribute);
 }
Example #9
0
 /// <summary>	
 /// 	Emit Byte 코드를 씁니다. 
 /// </summary>
 /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
 /// <param name="operand">	The operand. </param>
 public virtual void WriteEmit(ICodeLambda codeLambda, Operand operand)
 {
     throw new NotSupportedException();
 }
Example #10
0
 /// <summary>	
 /// 	Emit Byte코드를 읽습니다. 
 /// </summary>
 /// <param name="codeLambda">	<see cref="ICodeLambda"/> 를 구현하는 구현부 코드입니다. </param>
 public virtual void ReadEmit(ICodeLambda codeLambda)
 {
     throw new NotSupportedException();
 }
Example #11
0
 public virtual void WriteEmit(ICodeLambda codeLambda)
 {
     throw new NotImplementedException();
 }
Example #12
0
 public override void WriteEmit(ICodeLambda codeLambda, Operand operand)
 {
     base.WriteEmit(codeLambda, operand);
 }
Example #13
0
 public override void WriteEmit(ICodeLambda codeLambda)
 {
     base.WriteEmit(codeLambda);
 }
Example #14
0
 /// <summary>
 ///     Emit Byte코드를 읽습니다.
 /// </summary>
 /// <param name="codeLambda">	<see cref="ICodeLambda"/> 를 구현하는 구현부 코드입니다. </param>
 public virtual void ReadEmit(ICodeLambda codeLambda)
 {
     throw new NotSupportedException();
 }
Example #15
0
 /// <summary>
 ///     Emit Byte 코드를 씁니다.
 /// </summary>
 /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
 /// <param name="operand">	The operand. </param>
 public virtual void WriteEmit(ICodeLambda codeLambda, Operand operand)
 {
     throw new NotSupportedException();
 }
Example #16
0
 /// <summary>
 ///     Emit Byte코드를 읽습니다.
 /// </summary>
 /// <param name="codeLambda">	<see cref="ICodeLambda"/> 를 구현하는 구현부 코드입니다. </param>
 public override void ReadEmit(ICodeLambda codeLambda)
 {
     this.IL.Emit(OpCodes.Ldloc, this.Value);
 }
Example #17
0
 /// <summary>
 ///     Emit Byte 코드를 씁니다.
 /// </summary>
 /// <param name="codeLambda">	구현부 코드에 쓸 <see cref="ICodeLambda"/> 인터페이스를 구현하는 객체입니다. </param>
 public override void WriteEmit(ICodeLambda codeLambda)
 {
     this.localBuilder = codeLambda.IL.DeclareLocal(this.criteriaMetadataInfo.Type);
     localBuilder.SetLocalSymInfo(this.criteriaMetadataInfo.Name);
 }
Example #18
0
 public virtual void WriteEmit(ICodeLambda codeLambda)
 {
     throw new NotImplementedException();
 }