コード例 #1
0
ファイル: BuilderUtil.cs プロジェクト: pyzh/ZLanguage3
 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);
             }
         }
     }
 }
コード例 #2
0
 public void AnalyValue()
 {
     this.ProcContext = new ContextProc(this.ClassContext);
     foreach (var item in Properties)
     {
         item.AnalyValue(ProcContext);
     }
 }
コード例 #3
0
ファイル: PropertyAST.cs プロジェクト: pyzh/ZCompileCore2
        public void AnalyValue(ContextProc procContext)
        {
            if (PropertyValue == null)
            {
                PropertySymbol.HasDefaultValue = false;
                return;
            }
            PropertySymbol.HasDefaultValue = true;
            Exp        exp2    = null;
            ContextExp context = new ContextExp(procContext);

            PropertyValue.SetContext(context);
            exp2          = PropertyValue.Parse();
            exp2          = exp2.Analy();
            PropertyValue = exp2;
        }
コード例 #4
0
        private void CreateContext()
        {
            NestedClassContext           = new ContextClass(this.ExpContext.FileContext);
            NestedClassContext.ClassName = this.ExpContext.ProcContext.CreateNestedClassName();

            NestedProcContext                    = new ContextProc(NestedClassContext);
            NestedProcContext.ProcName           = NestedClassContext.ClassName + "$CALL";
            NestedProcContext.ProcManagerContext = NestedClassContext.ProcManagerContext;
            NestedProcContext.ProcManagerContext.Add(NestedProcContext);

            NestedStmt             = new StmtCall();
            NestedStmt.ProcContext = NestedProcContext;

            NestedExpContext = new ContextExp(NestedProcContext, NestedStmt);
            BodyExp.SetContext(NestedExpContext);
            CreateEmitContext();
        }
コード例 #5
0
ファイル: StmtRawParser.cs プロジェクト: pyzh/ZLanguage3
 public StmtRawParser(IEnumerable <LineTokenCollection> lineTokens, ContextProc context)
 {
     stmtList.Clear();
     this.context = context;
     tape         = new ArrayTape <LineTokenCollection>(lineTokens);
 }
コード例 #6
0
 public ChainItemFeaturer(ContextExp context)
 {
     Context     = context;
     ProcContext = context.ProcContext;
 }