From d720913779c2df77b49e8fba31d012c60c32eed3 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sun, 19 Feb 2006 10:40:06 +0000 Subject: In ilasm/codegen: * CodeGen.cs (CodeGen.ThisModule): New. (CodeGen.Write): Set module name if not set by '.module' directive. * Module.cs: Inherit from ExternRef. In class/PEAPI: * Metadata.cs (Module): Implment IExternRef to allow reference to types in 'this' module. svn path=/trunk/mcs/; revision=57044 --- mcs/class/PEAPI/ChangeLog | 5 +++++ mcs/class/PEAPI/Metadata.cs | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'mcs/class') diff --git a/mcs/class/PEAPI/ChangeLog b/mcs/class/PEAPI/ChangeLog index e2b2e9e0fde..4e9b76b6f68 100644 --- a/mcs/class/PEAPI/ChangeLog +++ b/mcs/class/PEAPI/ChangeLog @@ -1,3 +1,8 @@ +2006-02-19 Ankit Jain + + * Metadata.cs (Module): Implment IExternRef to allow reference to types + in 'this' module. + 2006-02-15 Raja R Harinath * Metadata.cs (BoundArray.CompressSignedNum): Document the diff --git a/mcs/class/PEAPI/Metadata.cs b/mcs/class/PEAPI/Metadata.cs index 083f8ba8fbe..86ac1099d8a 100644 --- a/mcs/class/PEAPI/Metadata.cs +++ b/mcs/class/PEAPI/Metadata.cs @@ -2510,7 +2510,7 @@ namespace PEAPI { /// /// Descriptor for THIS module /// - public class Module : ResolutionScope { + public class Module : ResolutionScope, IExternRef { Guid mvid; uint mvidIx = 0; @@ -2526,6 +2526,21 @@ namespace PEAPI { get { return mvid; } } + public ClassRef AddClass(string nsName, string name) + { + ClassRef aClass = new ClassRef (nsName, name, metaData); + metaData.AddToTable (MDTable.TypeRef, aClass); + aClass.SetParent (this); + return aClass; + } + + public ClassRef AddValueClass(string nsName, string name) + { + ClassRef aClass = AddClass (nsName, name); + aClass.MakeValueClass (ValueClass.ValueType); + return aClass; + } + internal sealed override uint Size(MetaData md) { return 2 + md.StringsIndexSize() + 3 * md.GUIDIndexSize(); -- cgit v1.2.3