Example #1
0
        public void EmitBody()
        {
            var IL = this.NestedMethodContext.GetILGenerator();
            List <ZCLocalVar> localList = this.NestedMethodContext.LocalManager.LocalVarList;

            BuilderUtil.EmitLocalVar(NestedMethodContext, false, IL, localList);
            //EmitLocalVar(IL, localList);
            ActionExp.Emit();
            //if (!ZTypeUtil.IsVoid(this.RetZType))
            //{
            //    IL.Emit(OpCodes.Ldloc_0);
            //}
            if (this.RetSymbol == null)
            {
                if (!ZTypeUtil.IsVoid(this.ActionExp.RetType))
                {
                    IL.Emit(OpCodes.Pop);
                }
            }
            else
            {
                EmitHelper.StormVar(IL, this.RetSymbol.VarBuilder);
            }
            IL.Emit(OpCodes.Ret);
            //CreateNestedType();
        }
Example #2
0
 private void EmitSubject()
 {
     if (!SearchedMethod.GetIsStatic())
     {
         SubjectExp.Emit();
     }
 }
Example #3
0
        public void EmitSet(Exp valueExp)
        {
            MethodInfo setMethod = Property.GetSetMethod();

            EmitHelper.LoadVar(IL, ListSymbol.VarBuilder);
            EmitHelper.LoadVar(IL, IndexSymbol.VarBuilder);
            valueExp.Emit();
            EmitHelper.CallDynamic(IL, setMethod);
        }
Example #4
0
        public override void Emit()
        {
            if (this.InneExps.Count != 1)
            {
                throw new CCException();
            }
            Exp exp = this.InneExps[0];

            exp.Emit();
        }
Example #5
0
 public override void Emit( )
 {
     if (OpToken.Kind == TokenKindSymbol.ADD)
     {
         RightExp.Emit();
     }
     else
     {
         if (ZTypeUtil.IsFloat(RetType))//(RetType.SharpType == typeof(float))
         {
             IL.Emit(OpCodes.Ldc_R4, 0.0);
         }
         else if (ZTypeUtil.IsInt(RetType))//if (RetType.SharpType == typeof(int))
         {
             EmitHelper.LoadInt(IL, 0);
         }
         RightExp.Emit();
         IL.Emit(OpCodes.Sub);
     }
     base.EmitConv();
 }
Example #6
0
        protected void EmitArgsExp(ZCParamInfo[] paramInfos, Exp[] args)
        {
            var size = paramInfos.Length;

            for (int i = 0; i < size; i++)
            {
                Exp argExp    = args[i];
                var parameter = paramInfos[i];
                argExp.RequireType = parameter.ZParamType;
                argExp.Emit();
            }
        }
Example #7
0
        public void EmitSet(Exp valueExp)
        {
            MethodInfo setMethod = Property.GetSetMethod();

            SubjectExp.Emit();
            ArgExp.RequireType = ZTypeManager.GetBySharpType(setMethod.GetParameters()[0].ParameterType) as ZType;
            ArgExp.Emit();
            //EmitHelper.Box(il, ArgExp.RetType, setMethod.GetParameters()[0].ParameterType);
            valueExp.RequireType = ZTypeManager.GetBySharpType(setMethod.GetParameters()[1].ParameterType) as ZType;
            valueExp.Emit();
            EmitHelper.CallDynamic(IL, setMethod);
        }
Example #8
0
        protected void EmitArgsExp(IEnumerable <Exp> args, IEnumerable <ZType> ztypes)
        {
            var args2   = new List <Exp>(args);
            var ztypes2 = new List <ZType>(ztypes);
            var size    = args2.Count;

            for (int i = 0; i < size; i++)
            {
                Exp argExp = args2[i];
                argExp.RequireType = ztypes2[i];
                argExp.Emit();
            }
        }
Example #9
0
 protected void EmitValueExp(Exp valueExp)
 {
     valueExp.RequireType = this.RetType;
     valueExp.Emit();
 }
Example #10
0
 protected void EmitArgExp(ZCParamInfo parameter, Exp argExp)
 {
     argExp.RequireType = parameter.ZParamType;
     argExp.Emit();
 }