Example #1
0
        public override __MethodImplMap __GetMethodImplMap()
        {
            PopulateGenericArguments();
            List <MethodInfo>         bodies       = new List <MethodInfo>();
            List <List <MethodInfo> > declarations = new List <List <MethodInfo> >();

            foreach (int i in module.MethodImpl.Filter(this.MetadataToken))
            {
                MethodInfo body  = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodBody, typeArgs, null);
                int        index = bodies.IndexOf(body);
                if (index == -1)
                {
                    index = bodies.Count;
                    bodies.Add(body);
                    declarations.Add(new List <MethodInfo>());
                }
                MethodInfo declaration = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null);
                declarations[index].Add(declaration);
            }
            __MethodImplMap map = new __MethodImplMap();

            map.TargetType         = this;
            map.MethodBodies       = bodies.ToArray();
            map.MethodDeclarations = new MethodInfo[declarations.Count][];
            for (int i = 0; i < map.MethodDeclarations.Length; i++)
            {
                map.MethodDeclarations[i] = declarations[i].ToArray();
            }
            return(map);
        }
Example #2
0
        public override __MethodImplMap __GetMethodImplMap()
        {
            List <MethodInfo>         bodies       = new List <MethodInfo>();
            List <List <MethodInfo> > declarations = new List <List <MethodInfo> >();
            int token = this.MetadataToken;

            // TODO use binary search?
            for (int i = 0; i < module.MethodImpl.records.Length; i++)
            {
                if (module.MethodImpl.records[i].Class == token)
                {
                    MethodInfo body  = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodBody, typeArgs, null);
                    int        index = bodies.IndexOf(body);
                    if (index == -1)
                    {
                        index = bodies.Count;
                        bodies.Add(body);
                        declarations.Add(new List <MethodInfo>());
                    }
                    MethodInfo declaration = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null);
                    declarations[index].Add(declaration);
                }
            }
            __MethodImplMap map = new __MethodImplMap();

            map.TargetType         = this;
            map.MethodBodies       = bodies.ToArray();
            map.MethodDeclarations = new MethodInfo[declarations.Count][];
            for (int i = 0; i < map.MethodDeclarations.Length; i++)
            {
                map.MethodDeclarations[i] = declarations[i].ToArray();
            }
            return(map);
        }
Example #3
0
		public override __MethodImplMap __GetMethodImplMap()
		{
			List<MethodInfo> bodies = new List<MethodInfo>();
			List<List<MethodInfo>> declarations = new List<List<MethodInfo>>();
			int token = this.MetadataToken;
			// TODO use binary search?
			for (int i = 0; i < module.MethodImpl.records.Length; i++)
			{
				if (module.MethodImpl.records[i].Class == token)
				{
					MethodInfo body = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodBody, typeArgs, null);
					int index = bodies.IndexOf(body);
					if (index == -1)
					{
						index = bodies.Count;
						bodies.Add(body);
						declarations.Add(new List<MethodInfo>());
					}
					MethodInfo declaration = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null);
					declarations[index].Add(declaration);
				}
			}
			__MethodImplMap map = new __MethodImplMap();
			map.TargetType = this;
			map.MethodBodies = bodies.ToArray();
			map.MethodDeclarations = new MethodInfo[declarations.Count][];
			for (int i = 0; i < map.MethodDeclarations.Length; i++)
			{
				map.MethodDeclarations[i] = declarations[i].ToArray();
			}
			return map;
		}
Example #4
0
		public override __MethodImplMap __GetMethodImplMap()
		{
			PopulateGenericArguments();
			List<MethodInfo> bodies = new List<MethodInfo>();
			List<List<MethodInfo>> declarations = new List<List<MethodInfo>>();
			foreach (int i in module.MethodImpl.Filter(this.MetadataToken))
			{
				MethodInfo body = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodBody, typeArgs, null);
				int index = bodies.IndexOf(body);
				if (index == -1)
				{
					index = bodies.Count;
					bodies.Add(body);
					declarations.Add(new List<MethodInfo>());
				}
				MethodInfo declaration = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null);
				declarations[index].Add(declaration);
			}
			__MethodImplMap map = new __MethodImplMap();
			map.TargetType = this;
			map.MethodBodies = bodies.ToArray();
			map.MethodDeclarations = new MethodInfo[declarations.Count][];
			for (int i = 0; i < map.MethodDeclarations.Length; i++)
			{
				map.MethodDeclarations[i] = declarations[i].ToArray();
			}
			return map;
		}