//добавление локальной переменной public VarInfo AddVariable(IVAriableDefinitionNode var, LocalBuilder lb) { VarInfo vi = new VarInfo(lb); defs[var] = vi; return(vi); }
//добавление нелок. переменной public VarInfo AddNonLocalVariable(IVAriableDefinitionNode var, FieldBuilder fb) { VarInfo vi = new VarInfo(); defs[var] = vi; vi.fb = fb; vi.kind = VarKind.vkNonLocal; return(vi); }
//добавление локальной переменной public VarInfo AddVariable(IVAriableDefinitionNode var, LocalBuilder lb) { VarInfo vi = new VarInfo(lb); defs[var] = vi; return vi; }
//добавление нелок. переменной public VarInfo AddNonLocalVariable(IVAriableDefinitionNode var, FieldBuilder fb) { VarInfo vi = new VarInfo(); defs[var] = vi; vi.fb = fb; vi.kind = VarKind.vkNonLocal; return vi; }
//eto dlja inicializacii nelokalnyh peremennyh, tut nado ispolzovat disp!!!! private void AddInitCall(VarInfo vi, FieldBuilder fb, MethodInfo init_meth, IConstantNode init_value) { if (init_meth != null) { if (init_value == null || init_value != null && init_value.type.type_special_kind != type_special_kind.set_type && init_value.type.type_special_kind != type_special_kind.base_set_type) { //kladem displej tekushej procedury il.Emit(OpCodes.Ldloc, vi.meth.frame); PushLdfldWithOutLdarg(fb); il.Emit(OpCodes.Call, init_meth); } } if (init_value != null) { if (init_value is IRecordConstantNode) { LocalBuilder lb = il.DeclareLocal(fb.FieldType.MakePointerType()); il.Emit(OpCodes.Ldloc, vi.meth.frame); PushLdfldWithOutLdarg(fb); //PushLdfld(fb); il.Emit(OpCodes.Stloc, lb); GenerateRecordInitCode(il, lb, init_value as IRecordConstantNode); } else { if (!fb.IsStatic) { //PushLdfld(fb); //il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldloc, vi.meth.frame); init_value.visit(this); EmitBox(init_value, fb.FieldType); il.Emit(OpCodes.Stfld, fb); } else { init_value.visit(this); EmitBox(init_value, fb.FieldType); il.Emit(OpCodes.Stsfld, fb); } } } }