Пример #1
0
 public GenericMethodRef (BaseMethodRef meth, GenericMethodSig sig)
         : base (null, meth.CallConv, null, "", null, 0)
 {
         this.meth = meth;
         this.sig = sig;
         is_resolved = false;
 }
Пример #2
0
        public virtual BaseMethodRef GetMethodRef(BaseTypeRef ret_type,
                                                  PEAPI.CallConv call_conv, string name, BaseTypeRef[] param, int gen_param_count)
        {
            BaseMethodRef mr = null;

            /* Note: FullName not reqd as this is cached per object */
            string key = MethodDef.CreateSignature(ret_type, call_conv, name, param, gen_param_count, true);

            if (method_table == null)
            {
                method_table = new Hashtable();
            }
            else
            {
                mr = (BaseMethodRef)method_table [key];
            }

            if (mr == null)
            {
                mr = CreateMethodRef(ret_type, call_conv, name, param, gen_param_count);
                method_table [key] = mr;
            }

            return(mr);
        }
Пример #3
0
 public GenericMethodRef(BaseMethodRef meth, GenericMethodSig sig)
     : base(null, meth.CallConv, null, "", null, 0)
 {
     this.meth   = meth;
     this.sig    = sig;
     is_resolved = false;
 }
Пример #4
0
                public MethodInstr (PEAPI.MethodOp op, BaseMethodRef operand, Location loc)
			: base (loc)
                {
                        this.op = op;
                        this.operand = operand;

                        if (op == PEAPI.MethodOp.newobj || op == PEAPI.MethodOp.callvirt)
                                operand.CallConv |= PEAPI.CallConv.Instance;
                }
Пример #5
0
 public void AddOverride(string sig, BaseMethodRef decl)
 {
     if (override_long_list == null)
     {
         override_long_list = new ArrayList();
     }
     override_long_list.Add(new DictionaryEntry(sig,
                                                decl));
 }
Пример #6
0
        public MethodInstr(PEAPI.MethodOp op, BaseMethodRef operand, Location loc)
            : base(loc)
        {
            this.op      = op;
            this.operand = operand;

            if (op == PEAPI.MethodOp.newobj || op == PEAPI.MethodOp.callvirt)
            {
                operand.CallConv |= PEAPI.CallConv.Instance;
            }
        }
Пример #7
0
        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);
                }
            }
        }
Пример #8
0
 public void AddOverride (string sig, BaseMethodRef decl)
 {
         if (override_long_list == null)
                 override_long_list = new ArrayList ();
         override_long_list.Add (new DictionaryEntry (sig,
                                                 decl));
 }
Пример #9
0
 public CustomAttr(BaseMethodRef method_ref, byte[] data)
 {
     this.method_ref = method_ref;
     this.data       = data;
 }
Пример #10
0
                public LdtokenInstr (BaseMethodRef method_ref, Location loc)
			: base (loc)
                {
                        this.method_ref = method_ref;
                }
Пример #11
0
 public LdtokenInstr(BaseMethodRef method_ref, Location loc)
     : base(loc)
 {
     this.method_ref = method_ref;
 }
Пример #12
0
 public CustomAttr (BaseMethodRef method_ref, byte[] data)
 {
         this.method_ref = method_ref;
         this.data = data;
 }
Пример #13
0
 public CustomAttr (BaseMethodRef method_ref, PEAPI.Constant constant)
 {
     this.method_ref = method_ref;
     this.constant = constant;
 }
Пример #14
0
 public CustomAttr(BaseMethodRef method_ref, PEAPI.Constant constant)
 {
     this.method_ref = method_ref;
     this.constant   = constant;
 }