示例#1
0
 public PermissionMember(MemberTypes member_type, BaseTypeRef type_ref, string name, object value)
 {
     this.member_type = member_type;
     this.type_ref    = type_ref;
     this.name        = name;
     this.value       = value;
 }
示例#2
0
        public bool IsSuppressUnmanaged(CodeGen codegen)
        {
            string asmname = "";

            BaseTypeRef owner = method_ref.Owner;

            if (owner == null)
            {
                return(false);
            }

            ExternTypeRef etr = owner as ExternTypeRef;

            if (etr != null)
            {
                ExternAssembly ea = etr.ExternRef as ExternAssembly;
                if (ea != null)
                {
                    asmname = ea.Name;
                }
            }

            return(owner.FullName == "System.Security.SuppressUnmanagedCodeSecurityAttribute" &&
                   (asmname == "mscorlib" || codegen.IsThisAssembly("mscorlib")));
        }
示例#3
0
        public GlobalFieldRef(BaseTypeRef ret_type, string name)
        {
            this.ret_type = ret_type;
            this.name     = name;

            is_resolved = false;
        }
示例#4
0
文件: MethodDef.cs 项目: mdae/MonoRT
        static string CreateSignature(BaseTypeRef RetType, string name, BaseTypeRef[] param_list, int gen_param_count, bool include_optional)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(RetType.FullName);
            builder.Append(" ");
            builder.Append(name);
            if (gen_param_count > 0)
            {
                builder.AppendFormat("`{0}", gen_param_count);
            }
            builder.Append('(');

            if (param_list != null)
            {
                bool first = true;
                foreach (BaseTypeRef param in param_list)
                {
                    if (!first)
                    {
                        builder.Append(',');
                    }
                    builder.Append(param.FullName);
                    first = false;
                    if (!include_optional && param is SentinelTypeRef)
                    {
                        break;
                    }
                }
            }
            builder.Append(')');

            return(builder.ToString());
        }
示例#5
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);
        }
示例#6
0
文件: MethodDef.cs 项目: mdae/MonoRT
        static string CreateSignature(BaseTypeRef RetType, string name, IList param_list, int gen_param_count)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(RetType.FullName);
            builder.Append(" ");
            builder.Append(name);
            if (gen_param_count > 0)
            {
                builder.AppendFormat("`{0}", gen_param_count);
            }
            builder.Append('(');

            if (param_list != null)
            {
                bool first = true;
                foreach (ParamDef paramdef in param_list)
                {
                    if (!first)
                    {
                        builder.Append(',');
                    }
                    builder.Append(paramdef.TypeName);
                    first = false;
                }
            }
            builder.Append(')');

            return(builder.ToString());
        }
示例#7
0
 public PermissionMember (MemberTypes member_type, BaseTypeRef type_ref, string name, object value)
 {
         this.member_type = member_type;
         this.type_ref = type_ref;
         this.name = name;
         this.value = value;
 }
示例#8
0
文件: EventDef.cs 项目: nobled/mono
 public EventDef (FeatureAttr attr, BaseTypeRef type, string name)
 {
         this.attr = attr;
         this.name = name;
         this.type = type;
         is_resolved = false;
 }
示例#9
0
 public EventDef(FeatureAttr attr, BaseTypeRef type, string name)
 {
     this.attr   = attr;
     this.name   = name;
     this.type   = type;
     is_resolved = false;
 }
示例#10
0
                public GlobalFieldRef (BaseTypeRef ret_type, string name)
                {
                        this.ret_type = ret_type;
                        this.name = name;

			is_resolved = false;
                }
示例#11
0
文件: FieldRef.cs 项目: nobled/mono
                public FieldRef (TypeRef owner, BaseTypeRef ret_type, string name)
                {
                        this.owner = owner;
                        this.ret_type = ret_type;
                        this.name = name;
			
			is_resolved = false;
                }
        public TypeSpecFieldRef(BaseTypeRef owner, BaseTypeRef type, string name)
        {
            this.owner = owner;
            this.type  = type;
            this.name  = name;

            is_resolved = false;
        }
示例#13
0
 public PropertyDef (FeatureAttr attr, BaseTypeRef type, string name, ArrayList arg_list)
 {
         this.attr = attr;
         this.name = name;
         this.type = type;
         this.arg_list = arg_list;
         is_resolved = false;
 }
示例#14
0
        public FieldRef(TypeRef owner, BaseTypeRef ret_type, string name)
        {
            this.owner    = owner;
            this.ret_type = ret_type;
            this.name     = name;

            is_resolved = false;
        }
示例#15
0
                public ExternFieldRef (ExternTypeRef owner, BaseTypeRef type, string name)
                {
                        this.owner = owner;
                        this.type = type;
                        this.name = name;
			
			is_resolved = false;
                }
 public PropertyDef(FeatureAttr attr, BaseTypeRef type, string name, ArrayList arg_list)
 {
     this.attr     = attr;
     this.name     = name;
     this.type     = type;
     this.arg_list = arg_list;
     is_resolved   = false;
 }
示例#17
0
文件: TypeRef.cs 项目: nobled/mono
 protected override BaseMethodRef CreateMethodRef (BaseTypeRef ret_type,
         PEAPI.CallConv call_conv, string name, BaseTypeRef[] param, int gen_param_count)
 {
         if (SigMod == null | SigMod == "")
                 return new MethodRef (this, call_conv, ret_type, name, param, gen_param_count);
         else
                 return new TypeSpecMethodRef (this, call_conv, ret_type, name, param, gen_param_count);
 }
示例#18
0
文件: CalliInstr.cs 项目: nobled/mono
                public CalliInstr (PEAPI.CallConv call_conv, BaseTypeRef ret_type,
				   BaseTypeRef[] param, Location loc)
			: base (loc)
                {
                        this.call_conv = call_conv;
                        this.ret_type = ret_type;
                        this.param = param;
                }
 public CalliInstr(PEAPI.CallConv call_conv, BaseTypeRef ret_type,
                   BaseTypeRef[] param, Location loc)
     : base(loc)
 {
     this.call_conv = call_conv;
     this.ret_type  = ret_type;
     this.param     = param;
 }
示例#20
0
文件: ParamDef.cs 项目: nobled/mono
 public ParamDef (PEAPI.ParamAttr attr, string name,
                 BaseTypeRef typeref) {
         this.attr = attr;
         this.name = name;
         this.typeref = typeref;
         is_defined = false;
         defval = null;
 }
示例#21
0
文件: TypeDef.cs 项目: zixing131/mono
 public void AddOverride(MethodDef body, BaseTypeRef parent, string name)
 {
     if (override_list == null)
     {
         override_list = new ArrayList();
     }
     override_list.Add(new DictionaryEntry(body,
                                           new DictionaryEntry(parent, name)));
 }
 public ParamDef(PEAPI.ParamAttr attr, string name,
                 BaseTypeRef typeref)
 {
     this.attr    = attr;
     this.name    = name;
     this.typeref = typeref;
     is_defined   = false;
     defval       = null;
 }
示例#23
0
		public void AddConstraint (BaseTypeRef constraint)
		{
			if (constraint == null)
				throw new InternalErrorException ();

			if (constraintsList == null)
				constraintsList = new ArrayList ();

			constraintsList.Add (constraint);
		}
示例#24
0
文件: TypeDef.cs 项目: zixing131/mono
        private PEAPI.Method ResolveAsMethodRef(BaseTypeRef ret_type, PEAPI.CallConv call_conv,
                                                string name, BaseTypeRef [] param, int gen_param_count, CodeGen code_gen)
        {
            ExternTypeRef   type_ref  = code_gen.ThisModule.GetTypeRef(FullName, false);
            ExternMethodRef methodref = (ExternMethodRef)type_ref.GetMethodRef(ret_type, call_conv, name, param, gen_param_count);

            methodref.Resolve(code_gen);

            return(methodref.PeapiMethod);
        }
示例#25
0
		public void Add (BaseTypeRef type)
		{
			if (type == null)
				throw new InternalErrorException ();

			if (type_list == null)
				type_list = new ArrayList ();
			type_list.Add (type);
			type_str = null;
			type_arr = null;
		}
示例#26
0
                public MethodPointerTypeRef (PEAPI.CallConv callconv, BaseTypeRef ret, ArrayList param_list, ArrayList conv_list, string sig_mod)
                        : base (String.Empty, conv_list, sig_mod)
                {
                        this.callconv = callconv;
                        this.ret = ret;
                        this.param_list = param_list;

                        // We just need these to not break the interface
                        full_name = BuildTypeName ();
                        //sig_mod = String.Empty;
                }
        public MethodPointerTypeRef(PEAPI.CallConv callconv, BaseTypeRef ret, ArrayList param_list, ArrayList conv_list, string sig_mod)
            : base(String.Empty, conv_list, sig_mod)
        {
            this.callconv   = callconv;
            this.ret        = ret;
            this.param_list = param_list;

            // We just need these to not break the interface
            full_name = BuildTypeName();
            //sig_mod = String.Empty;
        }
示例#28
0
文件: TypeDef.cs 项目: zixing131/mono
        public PEAPI.Method ResolveMethod(BaseTypeRef ret_type, PEAPI.CallConv call_conv,
                                          string name, BaseTypeRef [] param, int gen_param_count, CodeGen code_gen)
        {
            string    signature = MethodDef.CreateSignature(ret_type, call_conv, name, param, gen_param_count, false);
            MethodDef methoddef = (MethodDef)method_table[signature];

            if (methoddef != null)
            {
                return(methoddef.Resolve(code_gen, classdef));
            }
            return(ResolveAsMethodRef(ret_type, call_conv, name, param, gen_param_count, code_gen));
        }
示例#29
0
文件: MethodDef.cs 项目: mdae/MonoRT
 // @include_optional: include optional parameters for vararg methods
 // This will be true mostly for *Ref use, eg. methodrefs at call sites
 // and false for *Def (include only the required params)
 public static string CreateSignature(BaseTypeRef RetType, PEAPI.CallConv call_conv, string name,
                                      BaseTypeRef[] param_list, int gen_param_count, bool include_optional)
 {
     if ((call_conv & PEAPI.CallConv.Vararg) != 0)
     {
         return(CreateVarargSignature(RetType, name, param_list, include_optional));
     }
     else
     {
         return(CreateSignature(RetType, name, param_list, gen_param_count, include_optional));
     }
 }
 protected override BaseMethodRef CreateMethodRef(BaseTypeRef ret_type,
                                                  PEAPI.CallConv call_conv, string name, BaseTypeRef[] param, int gen_param_count)
 {
     if (SigMod == null | SigMod == "")
     {
         return(new MethodRef(this, call_conv, ret_type, name, param, gen_param_count));
     }
     else
     {
         return(new TypeSpecMethodRef(this, call_conv, ret_type, name, param, gen_param_count));
     }
 }
示例#31
0
 public BaseMethodRef (BaseTypeRef owner, PEAPI.CallConv call_conv,
         BaseTypeRef ret_type, string name, BaseTypeRef[] param, int gen_param_count)
 {
         this.owner = owner;
         this.call_conv = call_conv;
         this.ret_type = ret_type;
         this.name = name;
         this.param = param;
         this.gen_param_count = gen_param_count;
         if (gen_param_count > 0)
                 CallConv |= PEAPI.CallConv.Generic;
         is_resolved = false;
 }
示例#32
0
        public void AddConstraint(BaseTypeRef constraint)
        {
            if (constraint == null)
            {
                throw new InternalErrorException();
            }

            if (constraintsList == null)
            {
                constraintsList = new ArrayList();
            }

            constraintsList.Add(constraint);
        }
示例#33
0
        public BaseMethodRef GetMethodRef(BaseTypeRef ret_type, PEAPI.CallConv call_conv,
                                          string name, BaseTypeRef[] param, int gen_param_count)
        {
            string            key = type_ref.FullName + MethodDef.CreateSignature(ret_type, name, param, gen_param_count) + type_ref.SigMod;
            TypeSpecMethodRef mr  = method_table [key] as TypeSpecMethodRef;

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

            return(mr);
        }
示例#34
0
                public override BaseMethodRef GetMethodRef (BaseTypeRef ret_type, PEAPI.CallConv call_conv,
                                string name, BaseTypeRef[] param, int gen_param_count)
                {
                        /* Use FullName also here, as we are caching in a static hashtable */
                        string key = FullName + MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, true);
                        TypeSpecMethodRef mr = s_method_table [key] as TypeSpecMethodRef;
                        if (mr != null)
                                return mr;

			//FIXME: generic methodref for primitive type?
                        mr = new TypeSpecMethodRef (this, call_conv, ret_type, name, param, gen_param_count);
                        s_method_table [key] = mr;
                        return mr;
                }
示例#35
0
文件: FieldDef.cs 项目: mono/mono
                public FieldDef (PEAPI.FieldAttr attr, string name,
                                BaseTypeRef type)
                {
                        this.attr = attr;
                        this.name = name;
                        this.type = type;

                        offset_set = false;
//                        datavalue_set = false;
                        value_set = false;

                        at_data_id = null;

                        is_resolved = false;
                }
示例#36
0
 public BaseMethodRef(BaseTypeRef owner, PEAPI.CallConv call_conv,
                      BaseTypeRef ret_type, string name, BaseTypeRef[] param, int gen_param_count)
 {
     this.owner           = owner;
     this.call_conv       = call_conv;
     this.ret_type        = ret_type;
     this.name            = name;
     this.param           = param;
     this.gen_param_count = gen_param_count;
     if (gen_param_count > 0)
     {
         CallConv |= PEAPI.CallConv.Generic;
     }
     is_resolved = false;
 }
示例#37
0
        protected override IFieldRef CreateFieldRef(BaseTypeRef ret_type, string field_name)
        {
            /* Note: Using FullName here as we are caching in a static hashtable */
            string key = FullName + ret_type.FullName + field_name;

            IFieldRef fr = (IFieldRef)s_field_table [key];

            if (fr == null)
            {
                fr = new TypeSpecFieldRef(this, ret_type, field_name);
                s_field_table [key] = fr;
            }

            return(fr);
        }
示例#38
0
文件: MethodDef.cs 项目: mdae/MonoRT
        public BaseTypeRef[] ParamTypeList()
        {
            if (param_list == null)
            {
                return(new BaseTypeRef[0]);
            }
            int count = 0;

            BaseTypeRef[] type_list = new BaseTypeRef[param_list.Count];
            foreach (ParamDef param in param_list)
            {
                type_list[count++] = param.Type;
            }
            return(type_list);
        }
示例#39
0
        public override BaseMethodRef GetMethodRef(BaseTypeRef ret_type, PEAPI.CallConv call_conv,
                                                   string meth_name, BaseTypeRef[] param, int gen_param_count)
        {
            /* Note: Using FullName here as we are caching in a static hashtable */
            string            key = FullName + MethodDef.CreateSignature(ret_type, call_conv, meth_name, param, gen_param_count, true);
            TypeSpecMethodRef mr  = s_method_table [key] as TypeSpecMethodRef;

            if (mr == null)
            {
                mr = new TypeSpecMethodRef(this, call_conv, ret_type, meth_name, param, gen_param_count);
                s_method_table [key] = mr;
            }

            return(mr);
        }
        public void Add(BaseTypeRef type)
        {
            if (type == null)
            {
                throw new InternalErrorException();
            }

            if (type_list == null)
            {
                type_list = new ArrayList();
            }
            type_list.Add(type);
            type_str = null;
            type_arr = null;
        }
示例#41
0
        public FieldDef(PEAPI.FieldAttr attr, string name,
                        BaseTypeRef type)
        {
            this.attr = attr;
            this.name = name;
            this.type = type;

            offset_set = false;
//                        datavalue_set = false;
            value_set = false;

            at_data_id = null;

            is_resolved = false;
        }
示例#42
0
        PEAPI.Type GetType(CodeGen code_gen, PEAPI.CustomModifier modifier, BaseTypeRef klass)
        {
            klass.Resolve(code_gen);
            var bcr = klass as BaseClassRef;

            if (bcr != null)
            {
                return(new PEAPI.CustomModifiedType(peapi_type, modifier, bcr.PeapiClass));
            }

            var pt = klass as PrimitiveTypeRef;

            return(new PEAPI.CustomModifiedType(peapi_type, modifier, code_gen.PEFile.AddPrimitiveType((PEAPI.PrimitiveType)pt.PeapiType)));

            throw new NotSupportedException(klass.GetType().ToString());
        }
示例#43
0
文件: TypeDef.cs 项目: zixing131/mono
        public PEAPI.Field ResolveField(string name, BaseTypeRef ret_type, CodeGen code_gen)
        {
            FieldDef fielddef = (FieldDef)field_table[new DictionaryEntry(name, ret_type.FullName)];

            if (fielddef != null)
            {
                return(fielddef.Resolve(code_gen, classdef));
            }

            ExternTypeRef type_ref = code_gen.ThisModule.GetTypeRef(FullName, false);
            IFieldRef     fieldref = type_ref.GetFieldRef(ret_type, name);

            fieldref.Resolve(code_gen);

            return(fieldref.PeapiField);
        }
示例#44
0
                public virtual IFieldRef GetFieldRef (BaseTypeRef ret_type, string name)
                {
                        IFieldRef fr = null;
                        string key = ret_type.FullName + name;

                        if (field_table == null)
                                field_table = new Hashtable ();
                        else
                                fr = (IFieldRef) field_table [key];

                        if (fr == null) {
                                fr = CreateFieldRef (ret_type, name);
                                field_table [key] = fr;
                        }

                        return fr;
                }
示例#45
0
文件: TypeDef.cs 项目: zixing131/mono
        public PEAPI.Method ResolveVarargMethod(BaseTypeRef ret_type, PEAPI.CallConv call_conv,
                                                string name, BaseTypeRef [] param, int gen_param_count, PEAPI.Type [] opt, CodeGen code_gen)
        {
            // Only MethodDef sig required to lookup in the method_table
            string    signature = MethodDef.CreateSignature(ret_type, call_conv, name, param, 0, false);
            MethodDef methoddef = (MethodDef)method_table[signature];

            if (methoddef != null)
            {
                methoddef.Resolve(code_gen, classdef);
                return(methoddef.GetVarargSig(
                           opt,
                           MethodDef.CreateSignature(ret_type, call_conv, name, param, 0, true)));
            }

            return(ResolveAsMethodRef(ret_type, call_conv, name, param, gen_param_count, code_gen));
        }
        public override BaseMethodRef GetMethodRef(BaseTypeRef ret_type, PEAPI.CallConv call_conv,
                                                   string name, BaseTypeRef[] param, int gen_param_count)
        {
            /* Use FullName also here, as we are caching in a static hashtable */
            string            key = FullName + MethodDef.CreateSignature(ret_type, call_conv, name, param, gen_param_count, true);
            TypeSpecMethodRef mr  = s_method_table [key] as TypeSpecMethodRef;

            if (mr != null)
            {
                return(mr);
            }

            //FIXME: generic methodref for primitive type?
            mr = new TypeSpecMethodRef(this, call_conv, ret_type, name, param, gen_param_count);
            s_method_table [key] = mr;
            return(mr);
        }
示例#47
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;
                }
示例#48
0
                public MethodDef (CodeGen codegen, PEAPI.MethAttr meth_attr,
				  PEAPI.CallConv call_conv, PEAPI.ImplAttr impl_attr,
				  string name, BaseTypeRef ret_type, ArrayList param_list,
				  Location start, GenericParameters gen_params, TypeDef type_def)
                {
                        this.codegen = codegen;
                        this.meth_attr = meth_attr;
                        this.call_conv = call_conv;
                        this.impl_attr = impl_attr;
                        this.name = name;
                        this.param_list = param_list;
                        this.type_def = type_def;
                        this.gen_params = gen_params;
                        this.ret_param = new ParamDef (PEAPI.ParamAttr.Default, "", ret_type);
                        this.start = (Location) start.Clone ();

                        inst_list = new ArrayList ();
                        label_table = new Hashtable ();
                        labelref_table = new Hashtable ();
                        label_list = new ArrayList ();
                        local_list = new ArrayList ();
                        named_local_tables = new ArrayList ();
                        named_local_tables.Add (new Hashtable ());
                        current_scope_depth = 0;

                        entry_point = false;
                        zero_init = false;
                        init_locals = false;
                        max_stack = -1;
                        pinvoke_info = false;

                        is_defined = false;
                        is_resolved = false;
                        ResolveGenParams ();
                        CreateSignature ();

			codegen.BeginMethodDef (this);

			if (codegen.SymbolWriter != null)
				source = codegen.SymbolWriter.BeginMethod (this, start);
                }
示例#49
0
                public GlobalMethodRef GetGlobalMethodRef (BaseTypeRef ret_type, PEAPI.CallConv call_conv,
                                string name, BaseTypeRef[] param, int gen_param_count)
                {
                        string key = MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, true);

                        GlobalMethodRef methref = null;

                        if (global_methodref_table == null)
                                global_methodref_table = new Hashtable ();
                        else
                                methref = (GlobalMethodRef) global_methodref_table [key];

                        if (methref == null) {
                                methref = new GlobalMethodRef (ret_type, call_conv, name, param, gen_param_count);
                                global_methodref_table [key] = methref;
                        }
                        
                        return methref;
                }
示例#50
0
文件: TypeRef.cs 项目: nobled/mono
 protected override IFieldRef CreateFieldRef (BaseTypeRef ret_type, string name)
 {
          return new FieldRef (this, ret_type, name);
 }
示例#51
0
                static string CreateVarargSignature (BaseTypeRef RetType, string name, IList param_list)
                {
                        StringBuilder builder = new StringBuilder ();
                        ParamDef last = null;

			builder.Append (RetType.FullName);
			builder.Append (" ");
                        builder.Append (name);
                        builder.Append ('(');

                        bool first = true;
                        if (param_list != null) {
                                foreach (ParamDef paramdef in param_list) {
                                        if (!first)
                                                builder.Append (',');
                                        builder.Append (paramdef.TypeName);
                                        first = false;
                                }
                                last = (ParamDef) param_list[param_list.Count - 1];
                        }

                        
                        if (last == null || !last.IsSentinel ()) {
                                if (!first)
                                        builder.Append (',');
                                builder.Append ("...");
                        }

                        builder.Append (')');

                        return builder.ToString ();
                }
示例#52
0
		public BaseMethodRef GetMethodRef (BaseTypeRef ret_type, PEAPI.CallConv call_conv,
				string name, BaseTypeRef[] param, int gen_param_count)
		{
			string key = type_ref.FullName + MethodDef.CreateSignature (ret_type, name, param, gen_param_count) + type_ref.SigMod;
			TypeSpecMethodRef mr = method_table [key] as TypeSpecMethodRef;
			if (mr == null) {	 
				mr = new TypeSpecMethodRef (this, ret_type, call_conv, name, param, gen_param_count);
				method_table [key] = mr;
			}

			return mr;
		}
示例#53
0
                public BaseTypeRef[] ParamTypeList () {

                        if (param_list == null)
                                return new BaseTypeRef[0];
                        int count = 0;
                        BaseTypeRef[] type_list = new BaseTypeRef[param_list.Count];
                        foreach (ParamDef param in param_list) {
                                type_list[count++] = param.Type;
                        }
                        return type_list;
                }
示例#54
0
				static string CreateSignature (BaseTypeRef RetType, string name, BaseTypeRef[] param_list, int gen_param_count, bool include_optional, PEAPI.CallConv call_conv)
                {
                        StringBuilder builder = new StringBuilder ();

						if ((call_conv & PEAPI.CallConv.Instance) != 0)
							builder.Append ("instance ");


			builder.Append (RetType.FullName);
			builder.Append (" ");
                        builder.Append (name);
                        if (gen_param_count > 0)
                                builder.AppendFormat ("`{0}", gen_param_count);
                        builder.Append ('(');

                        if (param_list != null) {
                                bool first = true;
                                foreach (BaseTypeRef param in param_list) {
                                        if (!first)
                                                builder.Append (',');
                                        builder.Append (param.FullName);
                                        first = false;
                                        if (!include_optional && param is SentinelTypeRef)
                                                break;
                                }
                        }
                        builder.Append (')');

                        return builder.ToString ();
                }
示例#55
0
				static string CreateVarargSignature (BaseTypeRef RetType, string name, BaseTypeRef [] param_list, bool include_optional)
                {
                        StringBuilder builder = new StringBuilder ();
                        BaseTypeRef last = null;

			builder.Append (RetType.FullName);
			builder.Append (" ");
                        builder.Append (name);
                        builder.Append ('(');

                        bool first = true;
                        if (param_list != null && param_list.Length > 0) {
                                foreach (BaseTypeRef param in param_list) {
                                        if (!first)
                                                builder.Append (',');
                                        builder.Append (param.FullName);
                                        first = false;
                                        last = param;
                                        if (!include_optional && param is SentinelTypeRef)
                                                break;
                                }
                                
                        }
                        
                        if (!include_optional && (last == null || !(last is SentinelTypeRef))) {
                                if (!first)
                                        builder.Append (',');
                                builder.Append ("...");
                        }

                        builder.Append (')');

                        return builder.ToString ();
                }
示例#56
0
 // @include_optional: include optional parameters for vararg methods
 // This will be true mostly for *Ref use, eg. methodrefs at call sites
 // and false for *Def (include only the required params)
 public static string CreateSignature (BaseTypeRef RetType, PEAPI.CallConv call_conv, string name,
                 BaseTypeRef[] param_list, int gen_param_count, bool include_optional)
 {
         if ((call_conv & PEAPI.CallConv.Vararg) != 0)
                 return CreateVarargSignature (RetType, name, param_list, include_optional);
         else
                 return CreateSignature (RetType, name, param_list, gen_param_count, include_optional, call_conv);
 }
示例#57
0
                public GlobalFieldRef GetGlobalFieldRef (BaseTypeRef ret_type, string name)
                {
                        string key = ret_type.FullName + name;

                        GlobalFieldRef fieldref = null;

                        if (global_fieldref_table == null)
                                global_fieldref_table = new Hashtable ();
                        else
                                fieldref = (GlobalFieldRef) global_fieldref_table [key];

                        if (fieldref == null) {
                                fieldref = new GlobalFieldRef (ret_type, name);
                                global_fieldref_table [key] = fieldref;
                        }
                        
                        return fieldref;
                }
示例#58
0
		public IFieldRef GetFieldRef (BaseTypeRef ret_type, string name)
		{
			return new TypeSpecFieldRef (this, ret_type, name);
		}
示例#59
0
 public ExternMethodRef (ExternTypeRef owner, BaseTypeRef ret_type,
         PEAPI.CallConv call_conv, string name, BaseTypeRef[] param, int gen_param_count)
         : base (owner, call_conv, ret_type, name, param, gen_param_count)
 {
 }
示例#60
0
				static string CreateSignature (BaseTypeRef RetType, string name, IList param_list, int gen_param_count, PEAPI.MethAttr attrs)
                {
                        StringBuilder builder = new StringBuilder ();

						if ((attrs & PEAPI.MethAttr.Static) == 0)
							builder.Append ("instance ");

			builder.Append (RetType.FullName);
			builder.Append (" ");
                        builder.Append (name);
                        if (gen_param_count > 0)
                                builder.AppendFormat ("`{0}", gen_param_count);
                        builder.Append ('(');

                        if (param_list != null) {
                                bool first = true;
                                foreach (ParamDef paramdef in param_list) {
                                        if (!first)
                                                builder.Append (',');
                                        builder.Append (paramdef.TypeName);
                                        first = false;
                                }
                        }
                        builder.Append (')');

                        return builder.ToString ();
                }