diff options
Diffstat (limited to 'mcs/ilasm/codegen/GenericMethodSig.cs')
-rw-r--r-- | mcs/ilasm/codegen/GenericMethodSig.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/mcs/ilasm/codegen/GenericMethodSig.cs b/mcs/ilasm/codegen/GenericMethodSig.cs new file mode 100644 index 00000000000..e8c74bec130 --- /dev/null +++ b/mcs/ilasm/codegen/GenericMethodSig.cs @@ -0,0 +1,64 @@ +// +// Mono.ILASM.GenericMethodSig +// +// Author(s): +// Jackson Harper (jackson@ximian.com) +// +// (C) 2003 Ximian, Inc (http://www.ximian.com) +// + +using System; +using System.Collections; + +namespace Mono.ILASM { + + public class GenericMethodSig { + + private GenericArguments gen_args; + private bool is_resolved; + private PEAPI.GenericMethodSig sig; + + private static Hashtable sig_table; + + public GenericMethodSig (GenericArguments gen_args) + { + this.gen_args = gen_args; + is_resolved = false; + } + + public PEAPI.GenericMethodSig Sig { + get { return sig; } + } + + public PEAPI.GenericMethodSig Resolve (CodeGen code_gen) + { + if (is_resolved) + return sig; + + sig = new PEAPI.GenericMethodSig (gen_args.Resolve (code_gen)); + is_resolved = true; + + return sig; + } + + public static GenericMethodSig GetInstance (GenericArguments gen_args) + { + GenericMethodSig sig = null; + + if (sig_table == null) + sig_table = new Hashtable (); + else + sig = (GenericMethodSig) sig_table [gen_args.ToString ()]; + + if (sig == null) { + sig = new GenericMethodSig (gen_args); + sig_table [gen_args.ToString ()] = sig; + } + + return sig; + } + } + +} + + |