Example #1
0
 public static void EmitLocalVar(ContextProc procContext, bool isStatic, ILGenerator IL, List <ZCLocalVar> localList)
 {
     localList.Reverse();
     for (int i = 0; i < localList.Count; i++)
     {
         ZCLocalVar varSymbol = localList[i];
         varSymbol.VarBuilder = IL.DeclareLocal(ZTypeUtil.GetTypeOrBuilder(varSymbol.GetZType()));
         varSymbol.VarBuilder.SetLocalSymInfo(varSymbol.ZName);
     }
     for (int i = 0; i < localList.Count; i++)
     {
         ZCLocalVar varSymbol = localList[i];
         if (varSymbol.IsNestedClassInstance)
         {
             LocalBuilder       lanmbdaLocalBuilder = procContext.NestedInstance.VarBuilder;
             ConstructorBuilder newBuilder          = procContext.GetNestedClassContext().DefaultConstructorBuilder;
             IL.Emit(OpCodes.Newobj, newBuilder);
             EmitHelper.StormVar(IL, lanmbdaLocalBuilder);
             if (!isStatic)
             {
                 ZCFieldInfo masterClassField = procContext.GetNestedClassContext().MasterClassField;
                 if (masterClassField != null)
                 {
                     ILGeneratorUtil.LoadLocal(IL, lanmbdaLocalBuilder);
                 }
                 IL.Emit(OpCodes.Ldarg_0);
                 EmitSymbolHelper.EmitStorm(IL, masterClassField);
             }
         }
     }
 }
Example #2
0
 public static void EmitLoad(ILGenerator il, ZLParamInfo zcparam)
 {
     ILGeneratorUtil.LoadArg(il, zcparam.EmitIndex);
 }