From d30bd82453a9c15d5300dbc4a8e4315b32211525 Mon Sep 17 00:00:00 2001 From: Kevin Glynn Date: Tue, 11 Jan 2011 12:05:25 +0100 Subject: [PATCH] add Unknowntype so we can keep track of made up types --- .../src/cs2j/CLR/TranslationTemplate.cs | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/CSharpTranslator/antlr3/src/cs2j/CLR/TranslationTemplate.cs b/CSharpTranslator/antlr3/src/cs2j/CLR/TranslationTemplate.cs index 15491fc..60decab 100644 --- a/CSharpTranslator/antlr3/src/cs2j/CLR/TranslationTemplate.cs +++ b/CSharpTranslator/antlr3/src/cs2j/CLR/TranslationTemplate.cs @@ -1687,5 +1687,61 @@ namespace RusticiSoftware.Translator.CLR #endregion + + } + + [XmlType("UnknownType")] + // For now, making as compatible as we can so inheriting from struct + public class UnknownRepTemplate : StructRepTemplate, IEquatable + { + + public UnknownRepTemplate () + { + } + + public UnknownRepTemplate (string typeName) : base(typeName) + { + } + + + public override TypeRep mkEmptyRep () + { + // hmm, nothing appropriate, and this should be going away .... + return new InterfaceRep (); + } + + #region Equality + public bool Equals (UnknownRepTemplate other) + { + return base.Equals(other); + } + + public override bool Equals (object obj) + { + + UnknownRepTemplate temp = obj as UnknownRepTemplate; + + if (!Object.ReferenceEquals (temp, null)) + return this.Equals (temp); + return false; + } + + public static bool operator == (UnknownRepTemplate a1, UnknownRepTemplate a2) + { + return Object.Equals (a1, a2); + } + + public static bool operator != (UnknownRepTemplate a1, UnknownRepTemplate a2) + { + return !(a1 == a2); + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + #endregion + + } }