示例#1
0
		public TypeRefTable GetTypeRefTable ()
		{
			TypeRefTable table = m_heap [TypeRefTable.RId] as TypeRefTable;
			if (table != null)
				return table;

			table = new TypeRefTable ();
			InitializeTable (table);
			return table;
		}
示例#2
0
 public override void VisitTypeRefTable(TypeRefTable table)
 {
     int number = m_rows [TypeRefTable.RId];
     table.Rows = new RowCollection (number);
     for (int i = 0; i < number; i++)
         table.Rows.Add (new TypeRefRow ());
 }
        public TypeRefTable GetTypeRefTable()
        {
            int rid = TypeRefTable.RId;
            if (m_heap.HasTable (rid))
                return m_heap [rid] as TypeRefTable;

            TypeRefTable table = new TypeRefTable ();
            table.Rows = new RowCollection ();
            m_heap.Valid |= 1L << rid;
            m_heap.Tables.Add (table);
            return table;
        }
示例#4
0
        void AddTypeRef(TypeRefTable typesRef, int i)
        {
            // Check if index has been already added.
            if (m_typeRefs [i] != null)
                return;

            TypeRefRow type = typesRef [i];
            IMetadataScope scope = null;
            TypeReference parent = null;

            if (type.ResolutionScope.RID != 0) {
                int rid = (int) type.ResolutionScope.RID - 1;
                switch (type.ResolutionScope.TokenType) {
                case TokenType.AssemblyRef:
                    scope = m_module.AssemblyReferences [rid];
                    break;
                case TokenType.ModuleRef:
                    scope = m_module.ModuleReferences [rid];
                    break;
                case TokenType.Module:
                    scope = m_module.Assembly.Modules [rid];
                    break;
                case TokenType.TypeRef:
                    AddTypeRef (typesRef, rid);
                    parent = GetTypeRefAt (type.ResolutionScope.RID);
                    scope = parent.Scope;
                    break;
                }
            }

            TypeReference t = new TypeReference (
                m_root.Streams.StringsHeap [type.Name],
                m_root.Streams.StringsHeap [type.Namespace],
                scope);
            t.MetadataToken = MetadataToken.FromMetadataRow (TokenType.TypeRef, i);

            if (parent != null)
                t.DeclaringType = parent;

            m_typeRefs [i] = t;
            m_module.TypeReferences.Add (t);
        }
示例#5
0
		void EncodeTypeRefTable (TypeRefTable table)
		{
			int index = 0;

			foreach (TypeRefRow row in table.Rows) {
				this.asm.ALIGN (Assembly.OBJECT_ALIGNMENT);
				this.asm.LABEL (moduleName + " TypeRefRow#" + index);
				this.asm.AddObjectFields (typeof (SharpOS.AOT.Metadata.TypeRefRow).ToString ());

				this.asm.DATA (row.ResolutionScope.ToUInt ());
				this.asm.DATA (row.Name);
				this.asm.DATA (row.Namespace);

				++index;
			}

			this.MetadataArray ("TypeRef", table);
		}