Esempio n. 1
0
        //private void EmitGetNested()
        //{
        //    if (this.NestedFieldSymbol != null)
        //    {
        //        EmitHelper.EmitThis(IL, false);
        //        EmitSymbolHelper.EmitLoad(IL, this.NestedFieldSymbol);
        //        base.EmitConv();
        //    }
        //    else
        //    {
        //        throw new CCException();
        //    }
        //}

        public override void EmitSet(Exp valueExp)
        {
            if (this.ClassContext is ContextNestedClass)
            {
                FieldBuilder fieldBuilder = this.ProcContext.ClassContext.GetZCompilingType()
                                            .SearchDeclaredZField(VarName).FieldBuilder;

                EmitHelper.EmitThis(IL, false);
                EmitValueExp(valueExp);
                EmitHelper.StormField(IL, fieldBuilder);
            }
            else if (LocalVarSymbol.IsReplaceToNestedFiled)
            {
                ZCClassInfo  classType    = this.ProcContext.GetNestedClassContext().GetZCompilingType();
                FieldBuilder fieldBuilder = classType.SearchDeclaredZField(VarName).FieldBuilder;
                ZCLocalVar   instanceVar  = this.ProcContext.NestedInstance;

                EmitSymbolHelper.EmitLoad(IL, instanceVar);
                EmitValueExp(valueExp);
                EmitHelper.StormField(IL, fieldBuilder);
                base.EmitConv();
            }
            else
            {
                EmitValueExp(valueExp);
                EmitSymbolHelper.EmitStorm(IL, LocalVarSymbol);
            }
        }
Esempio n. 2
0
 public override void Emit()
 {
     base.EmitArgsExp(new Exp[] { LeftExp, RightExp }, OpMethod);
     EmitHelper.CallDynamic(IL, OpMethod);
     EmitSymbolHelper.EmitStorm(IL, TempStormLocalVarSymbol);
     EmitSymbolHelper.EmitLoad(IL, TempStormLocalVarSymbol);
     base.EmitConv();
 }
Esempio n. 3
0
        //private void EmitInitLocal(LocalBuilder lanmbdaLocalBuilder)
        //{
        //    for (int i = 0; i < this.lambdaInfo.BodyZVars.Count; i++)
        //    {
        //        ZCLocalVar varSymbol = this.lambdaInfo.BodyZVars[i];
        //        ZCFieldInfo fieldSymbol = lambdaExp.lambdaBody.Get(varSymbol.ZName);
        //        if (fieldSymbol == null) throw new CCException();
        //        EmitHelper.LoadVar(IL, lanmbdaLocalBuilder);
        //        EmitSymbolHelper.EmitLoad(IL, varSymbol);
        //        EmitSymbolHelper.EmitStorm(IL, fieldSymbol);
        //    }
        //}

        private void EmitInitOutField(LocalBuilder lanmbdaLocalBuilder)
        {
            if (this.ExpContext.ClassContext.IsStatic() == false)
            {
                ZCFieldInfo fieldSymbol = lambdaExp.lambdaBody.OutClassField;
                EmitHelper.LoadVar(IL, lanmbdaLocalBuilder);
                EmitHelper.EmitThis(IL, false);
                EmitSymbolHelper.EmitStorm(IL, fieldSymbol);
            }
        }
Esempio n. 4
0
        public override void EmitSet(Exp valueExp)
        {
            if (this.ClassContext is ContextNestedClass)
            {
                FieldBuilder fieldBuilder = this.ProcContext.ClassContext.GetZCompilingType()
                                            .SearchDeclaredZField(VarName).FieldBuilder;

                EmitHelper.EmitThis(IL, false);
                EmitValueExp(valueExp);
                EmitHelper.StormField(IL, fieldBuilder);
                base.EmitConv();
            }
            else
            {
                EmitValueExp(valueExp);
                EmitSymbolHelper.EmitStorm(IL, ArgSymbol);
            }
        }
Esempio n. 5
0
 private void EmitLeft()
 {
     if (SubjectExp.RetType.IsStruct)
     {
         if (IsNeedTempLocal())
         {
             SubjectExp.Emit();
             EmitSymbolHelper.EmitStorm(IL, this.tempLocal);
             EmitSymbolHelper.EmitLoada(IL, this.tempLocal);
         }
         else
         {
             if (SubjectExp is ExpLocalVar)
             {
                 ((ExpLocalVar)SubjectExp).EmitLoadLocala();
             }
             else if (SubjectExp is ExpArg)
             {
                 ((ExpArg)SubjectExp).EmitLoadArga();
             }
             else if (SubjectExp is ExpFieldDef)
             {
                 ((ExpFieldDef)SubjectExp).EmitLoadFielda();
             }
             else if (SubjectExp is ExpFieldSuper)
             {
                 ((ExpFieldSuper)SubjectExp).EmitLoadFielda();
             }
             else if (SubjectExp is ExpUseField)
             {
                 ((ExpUseField)SubjectExp).EmitLoadFielda();
             }
             else
             {
                 SubjectExp.Emit();
             }
         }
     }
     else
     {
         SubjectExp.Emit();
     }
 }
Esempio n. 6
0
        private void EmitInitArg(LocalBuilder lanmbdaLocalBuilder)
        {
            if (this.ProcContext.ArgList.Count > 0)
            {
                foreach (var arg in this.ProcContext.ArgList)
                {
                    ZCParamInfo paramSymbol = this.ProcContext.GetParameter(arg);
                    ZCFieldInfo fieldSymbol = this.ProcContext.GetNestedClassContext().MasterArgDict[arg];
                    EmitHelper.LoadVar(IL, lanmbdaLocalBuilder);
                    EmitSymbolHelper.EmitLoad(IL, paramSymbol);
                    EmitSymbolHelper.EmitStorm(IL, fieldSymbol);
                }
            }

            //for (int i = 0; i < this.lambdaInfo.BodyZParams.Count; i++)
            //{
            //    ZCParamInfo paramSymbol = this.lambdaInfo.BodyZParams[i];
            //    ZCFieldInfo fieldSymbol = lambdaExp.lambdaBody.Get(paramSymbol.ZName);
            //    EmitHelper.LoadVar(IL, lanmbdaLocalBuilder);
            //    EmitSymbolHelper.EmitLoad(IL, paramSymbol);
            //    EmitSymbolHelper.EmitStorm(IL, fieldSymbol);
            //}
        }
Esempio n. 7
0
 private void EmitSetMember()
 {
     if (memberSymbol is ZLFieldInfo)
     {
         EmitSymbolHelper.EmitStorm(IL, (ZLFieldInfo)memberSymbol);
     }
     else if (memberSymbol is ZCFieldInfo)
     {
         EmitSymbolHelper.EmitStorm(IL, (ZCFieldInfo)memberSymbol);
     }
     else if (memberSymbol is ZLPropertyInfo)
     {
         EmitSymbolHelper.EmitStorm(IL, (ZLPropertyInfo)memberSymbol);
     }
     else if (memberSymbol is ZCPropertyInfo)
     {
         EmitSymbolHelper.EmitStorm(IL, (ZCPropertyInfo)memberSymbol);
     }
     else
     {
         throw new CCException();
     }
 }
Esempio n. 8
0
 public void EmitSet(Exp valueExp)
 {
     if (IsNested)
     {
         if (this.NestedFieldSymbol != null)
         {
             EmitHelper.Emit_LoadThis(IL);
             EmitValueExp(valueExp);
             EmitSymbolHelper.EmitStorm(IL, this.NestedFieldSymbol);
         }
         else if (VarSymbol is SymbolDefProperty)
         {
             if (this.ClassContext.IsStaticClass == false)
             {
                 EmitHelper.Emit_LoadThis(IL);
                 EmitHelper.LoadField(IL, this.ClassContext.NestedOutFieldSymbol.Field);
             }
             EmitValueExp(valueExp);
             EmitSymbolHelper.EmitStorm(IL, VarSymbol);
         }
         else
         {
             throw new CompileException();
         }
     }
     else
     {
         if (EmitSymbolHelper.NeedCallThis(VarSymbol))
         {
             EmitHelper.Emit_LoadThis(IL);
         }
         EmitValueExp(valueExp);
         EmitSymbolHelper.EmitStorm(IL, VarSymbol);
         base.EmitConv();
     }
 }