public override void Resolve(CodeGen code_gen) { if (is_resolved) { return; } meth.Resolve(code_gen); peapi_method = code_gen.PEFile.AddMethodSpec(meth.PeapiMethod, sig.Resolve(code_gen)); is_resolved = true; }
public override void Emit(CodeGen code_gen, MethodDef meth, PEAPI.CILInstructions cil) { if (field_ref != null) { field_ref.Resolve(code_gen); cil.FieldInst(PEAPI.FieldOp.ldtoken, field_ref.PeapiField); } else if (method_ref != null) { method_ref.Resolve(code_gen); cil.MethInst(PEAPI.MethodOp.ldtoken, method_ref.PeapiMethod); } else if (type_ref != null) { type_ref.Resolve(code_gen); cil.TypeInst(PEAPI.TypeOp.ldtoken, type_ref.PeapiType); } }
public void DefineContents(CodeGen code_gen) { ArrayList fielddef_list = new ArrayList(); foreach (FieldDef fielddef in field_list) { if (is_enum_class && fielddef.Name == "value__") { fielddef.Attributes |= PEAPI.FieldAttr.SpecialName | PEAPI.FieldAttr.RTSpecialName; } fielddef.Define(code_gen, classdef); fielddef_list.Add(fielddef.PeapiFieldDef); } classdef.SetFieldOrder(fielddef_list); foreach (MethodDef methoddef in method_list) { methoddef.Define(code_gen); } if (event_list != null) { foreach (EventDef eventdef in event_list) { eventdef.Define(code_gen, classdef); } } if (property_list != null) { foreach (PropertyDef propdef in property_list) { propdef.Define(code_gen, classdef); } } if (customattr_list != null) { foreach (CustomAttr customattr in customattr_list) { customattr.AddTo(code_gen, classdef); if (customattr.IsSuppressUnmanaged(code_gen)) { classdef.AddAttribute(PEAPI.TypeAttr.HasSecurity); } } } /// Add declarative security to this class if (decl_sec != null) { decl_sec.AddTo(code_gen, classdef); classdef.AddAttribute(PEAPI.TypeAttr.HasSecurity); } if (override_list != null) { foreach (DictionaryEntry entry in override_list) { MethodDef body = (MethodDef)entry.Key; DictionaryEntry decl = (DictionaryEntry)entry.Value; BaseTypeRef parent_type = (BaseTypeRef)decl.Key; parent_type.Resolve(code_gen); string over_name = (string)decl.Value; BaseMethodRef over_meth = parent_type.GetMethodRef(body.RetType, body.CallConv, over_name, body.ParamTypeList(), body.GenParamCount); over_meth.Resolve(code_gen); classdef.AddMethodOverride(over_meth.PeapiMethod, body.PeapiMethodDef); } } if (override_long_list != null) { foreach (DictionaryEntry entry in override_long_list) { string sig = (string)entry.Key; BaseMethodRef decl = (BaseMethodRef)entry.Value; MethodDef body = (MethodDef)method_table[sig]; decl.Resolve(code_gen); classdef.AddMethodOverride(decl.PeapiMethod, body.PeapiMethodDef); } } }
public void AddTo(CodeGen code_gen, PEAPI.MetaDataElement elem) { method_ref.Resolve(code_gen); code_gen.PEFile.AddCustomAttribute(method_ref.PeapiMethod, data, elem); }
public override void Emit(CodeGen code_gen, MethodDef meth, PEAPI.CILInstructions cil) { operand.Resolve(code_gen); cil.MethInst(op, operand.PeapiMethod); }