diff options
author | Jb Evain <jbevain@gmail.com> | 2009-01-06 18:03:39 +0300 |
---|---|---|
committer | Jb Evain <jbevain@gmail.com> | 2009-01-06 18:03:39 +0300 |
commit | 61972b798225377735c2f109770a399334d29a80 (patch) | |
tree | 760aa1d5cacb5c06d85ddc906c5df4abdb39cb32 /mcs/tools/corcompare | |
parent | a22e90907a0baf2088d7c095e1dd8633c1265e88 (diff) |
remove code which actually lives in mono-tools/
svn path=/trunk/mcs/; revision=122552
Diffstat (limited to 'mcs/tools/corcompare')
-rw-r--r-- | mcs/tools/corcompare/CecilMetadata.cs | 983 | ||||
-rw-r--r-- | mcs/tools/corcompare/CompareContext.cs | 520 | ||||
-rw-r--r-- | mcs/tools/corcompare/Comparison.cs | 95 | ||||
-rw-r--r-- | mcs/tools/corcompare/MasterMetadata.cs | 692 | ||||
-rw-r--r-- | mcs/tools/corcompare/Masterinfo.cs | 1067 | ||||
-rw-r--r-- | mcs/tools/corcompare/Metadata.cs | 267 |
6 files changed, 0 insertions, 3624 deletions
diff --git a/mcs/tools/corcompare/CecilMetadata.cs b/mcs/tools/corcompare/CecilMetadata.cs deleted file mode 100644 index 8be78bd250b..00000000000 --- a/mcs/tools/corcompare/CecilMetadata.cs +++ /dev/null @@ -1,983 +0,0 @@ -// -// CecilMetadata.cs -// -// (C) 2007 - 2008 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -using Mono.Cecil; -using Mono.Cecil.Cil; - -namespace GuiCompare { - - static class CecilUtils { - - public static string PrettyType (TypeReference type) - { - var gen_instance = type as GenericInstanceType; - if (gen_instance != null) { - if (gen_instance.ElementType.FullName == "System.Nullable`1") - return PrettyType (gen_instance.GenericArguments [0]) + "?"; - - var signature = new StringBuilder (); - signature.Append (PrettyType (gen_instance.ElementType)); - signature.Append ("<"); - for (int i = 0; i < gen_instance.GenericArguments.Count; i++) { - if (i > 0) - signature.Append (","); - - signature.Append (PrettyType (gen_instance.GenericArguments [i])); - } - signature.Append (">"); - - return signature.ToString (); - } - - var array = type as ArrayType; - if (array != null) - return PrettyType (array.ElementType) + "[]"; - - var reference = type as ReferenceType; - if (reference != null) - return PrettyType (reference.ElementType) + "&"; - - var pointer = type as PointerType; - if (pointer != null) - return PrettyType (pointer.ElementType) + "*"; - - switch (type.FullName) { - case "System.Boolean": return "bool"; - case "System.Byte": return "byte"; - case "System.Char": return "char"; - case "System.Decimal": return "decimal"; - case "System.Double": return "double"; - case "System.Int16": return "short"; - case "System.Int32": return "int"; - case "System.Int64": return "long"; - case "System.Object": return "object"; - case "System.SByte": return "sbyte"; - case "System.Single": return "float"; - case "System.String": return "string"; - case "System.UInt16": return "ushort"; - case "System.UInt32": return "uint"; - case "System.UInt64": return "ulong"; - case "System.Void": return "void"; - } - - return type.Name; - } - - // the corcompare xml output uses a different formatting than Cecil. - // Cecil uses / for nested classes, ala: - // Namespace.Class/NestedClass - // while corcompare uses: - // Namespace.Class+NestedClass - // also, generic methods are done differently as well. - // cecil: Foo<T> - // corcompare: Foo[T] - // - // so let's just convert everything to corcompare's way of thinking for comparisons. - // - public static string FormatTypeLikeCorCompare (TypeReference type) - { - return type.FullName.Replace ('/', '+') - .Replace ('<', '[') - .Replace ('>', ']'); - } - - static bool IsExplicitInterfaceImplementation (MethodDefinition md) - { - OverrideCollection overrides = md.Overrides; - if (overrides == null || overrides.Count == 0) - return false; - - return true; - } - - public static void PopulateMemberLists (TypeDefinition fromDef, - List<CompNamed> interface_list, - List<CompNamed> constructor_list, - List<CompNamed> method_list, - List<CompNamed> property_list, - List<CompNamed> field_list, - List<CompNamed> event_list) - { - if (interface_list != null) { - foreach (TypeReference ifc in fromDef.Interfaces) { - TypeDefinition ifc_def = CecilUtils.Resolver.Resolve (ifc); - if (ifc_def.IsNotPublic) - continue; - interface_list.Add (new CecilInterface (ifc)); - } - - // Walk the parent hierarchy, we need to gather all the inherited - // interfaces as well to avoid false positives in comparison - TypeReference base_type = fromDef.BaseType; - if (base_type != null) { - TypeDefinition base_type_def = CecilUtils.Resolver.Resolve (base_type); - PopulateMemberLists (base_type_def, interface_list, null, null, null, null, null); - } - } - - if (constructor_list != null) { - foreach (MethodDefinition md in fromDef.Constructors) { - if (md.IsPrivate || md.IsAssembly) - continue; - constructor_list.Add (new CecilMethod (md)); - } - } - if (method_list != null) { - foreach (MethodDefinition md in fromDef.Methods) { - if (md.IsSpecialName) { - if (!md.Name.StartsWith("op_") && !IsExplicitInterfaceImplementation (md)) - continue; - } else { - if (md.IsAssembly) - continue; - - if (md.IsPrivate && !IsExplicitInterfaceImplementation (md)) - continue; - } - - method_list.Add (new CecilMethod (md)); - } - } - if (property_list != null) { - MethodDefinition getMethod, setMethod; - foreach (PropertyDefinition pd in fromDef.Properties) { - bool include_set = true; - bool include_get = true; - - setMethod = pd.SetMethod; - if (setMethod == null || (setMethod.IsPrivate || setMethod.IsAssembly)) - include_set = false; - - getMethod = pd.GetMethod; - if (getMethod == null || (getMethod.IsPrivate || getMethod.IsAssembly)) - include_get = false; - - if (include_set || include_get) - property_list.Add (new CecilProperty (pd)); - } - } - if (field_list != null) { - foreach (FieldDefinition fd in fromDef.Fields) { - if (fd.IsSpecialName) - continue; - if (fd.IsPrivate || fd.IsAssembly){ - //Console.WriteLine (" Skipping over {0}.{1} {2}", fromDef.Namespace, fromDef.Name, fd.Name); - continue; - } - //Console.WriteLine (" Adding {0}.{1} {2}", fromDef.Namespace, fromDef.Name, fd.Name); - field_list.Add (new CecilField (fd)); - } - } - if (event_list != null) { - foreach (EventDefinition ed in fromDef.Events) { - if (ed.IsSpecialName) - continue; - - if (ed.AddMethod == null || ed.AddMethod.IsPrivate || ed.AddMethod.IsAssembly) - continue; - - event_list.Add (new CecilEvent (ed)); - } - } - } - - public static void PopulateTypeLists (TypeDefinition fromDef, - List<CompNamed> class_list, - List<CompNamed> enum_list, - List<CompNamed> delegate_list, - List<CompNamed> interface_list, - List<CompNamed> struct_list) - { - foreach (TypeDefinition type_def in fromDef.NestedTypes) { - //Console.WriteLine ("Got {0}.{1} => {2}", type_def.Namespace, type_def.Name, type_def.Attributes & TypeAttributes.VisibilityMask); - if (type_def.IsNestedPrivate || type_def.IsNestedAssembly || type_def.IsNotPublic){ - continue; - } - - if (type_def.IsValueType) { - if (type_def.IsEnum) { - enum_list.Add (new CecilEnum (type_def)); - } - else { - struct_list.Add (new CecilClass (type_def, CompType.Struct)); - } - } - else if (type_def.IsInterface) { - interface_list.Add (new CecilInterface (type_def)); - } - else if ((type_def.FullName == "System.MulticastDelegate" || - type_def.BaseType.FullName == "System.MulticastDelegate") - || (type_def.FullName == "System.Delegate" || - type_def.BaseType.FullName == "System.Delegate")) { - delegate_list.Add (new CecilDelegate (type_def)); - } - else { - class_list.Add (new CecilClass (type_def, CompType.Class)); - } - } - } - - public static string GetTODOText (CustomAttribute ca) - { - StringBuilder sb = new StringBuilder(); - bool first = true; - foreach (object o in ca.ConstructorParameters) { - if (!first) - sb.Append (", "); - first = false; - sb.Append (o.ToString()); - } - - return sb.ToString(); - } - - public static bool IsTODOAttribute (TypeDefinition typedef) - { - if (typedef == null) - return false; - - if (typedef.Name == "MonoTODOAttribute") - return true; - - if (typedef.BaseType == null) - return false; - - return IsTODOAttribute (CecilUtils.Resolver.Resolve (typedef.BaseType)); - } - - public static bool ShouldSkipAttribute (string name) - { - if (name == "System.Diagnostics.CodeAnalysis.SuppressMessageAttribute") - return true; - - return false; - } - - public static List<CompNamed> GetCustomAttributes (ICustomAttributeProvider provider, List<string> todos) - { - List<CompNamed> rv = new List<CompNamed>(); - foreach (CustomAttribute ca in provider.CustomAttributes) { - TypeDefinition resolved = CecilUtils.Resolver.Resolve (ca.Constructor.DeclaringType); - - if (resolved != null) { - if (IsTODOAttribute (resolved)) { - todos.Add (String.Format ("[{0} ({1})]", ca.Constructor.DeclaringType.Name, CecilUtils.GetTODOText (ca))); - continue; - } - - if (resolved.IsNotPublic) - continue; - } - - if (!ShouldSkipAttribute (ca.Constructor.DeclaringType.FullName)) - rv.Add (new CecilAttribute (ca)); - } - return rv; - } - - - public static readonly AssemblyResolver Resolver = new AssemblyResolver(); - } - - public class CecilAssembly : CompAssembly { - public CecilAssembly (string path) - : base (Path.GetFileName (path)) - { - Dictionary<string, Dictionary <string, TypeDefinition>> namespaces = new Dictionary<string, Dictionary <string, TypeDefinition>> (); - - AssemblyDefinition assembly = AssemblyFactory.GetAssembly(path); - - foreach (TypeDefinition t in assembly.MainModule.Types) { - if (t.Name == "<Module>") - continue; - - if (t.IsNotPublic) - continue; - - if (t.IsNested) - continue; - - if (t.IsSpecialName || t.IsRuntimeSpecialName) - continue; - - if (CecilUtils.IsTODOAttribute (t)) - continue; - - if (!namespaces.ContainsKey (t.Namespace)) - namespaces[t.Namespace] = new Dictionary <string, TypeDefinition> (); - - namespaces[t.Namespace][t.Name] = t; - } - - namespace_list = new List<CompNamed>(); - foreach (string ns_name in namespaces.Keys) { - namespace_list.Add (new CecilNamespace (ns_name, namespaces[ns_name])); - } - - attributes = CecilUtils.GetCustomAttributes (assembly, todos); - } - - public override List<CompNamed> GetNamespaces() - { - return namespace_list; - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - List<CompNamed> namespace_list; - List<CompNamed> attributes; - } - - public class CecilNamespace : CompNamespace { - public CecilNamespace (string name, Dictionary<string, TypeDefinition> type_mapping) - : base (name) - { - class_list = new List<CompNamed>(); - enum_list = new List<CompNamed>(); - delegate_list = new List<CompNamed>(); - interface_list = new List<CompNamed>(); - struct_list = new List<CompNamed>(); - - foreach (string type_name in type_mapping.Keys) { - TypeDefinition type_def = type_mapping[type_name]; - if (type_def.IsNotPublic) - continue; - if (type_def.IsValueType) { - if (type_def.IsEnum) { - enum_list.Add (new CecilEnum (type_def)); - } - else { - if (type_def.FullName == "System.Enum") - class_list.Add (new CecilClass (type_def, CompType.Class)); - else - struct_list.Add (new CecilClass (type_def, CompType.Struct)); - } - } - else if (type_def.IsInterface) { - interface_list.Add (new CecilInterface (type_def)); - } - else if ((type_def.FullName == "System.MulticastDelegate" || - (type_def.BaseType != null && type_def.BaseType.FullName == "System.MulticastDelegate")) - || (type_def.FullName == "System.Delegate" || - (type_def.BaseType != null && type_def.BaseType.FullName == "System.Delegate"))) { - delegate_list.Add (new CecilDelegate (type_def)); - } - else { - class_list.Add (new CecilClass (type_def, CompType.Class)); - } - } - } - - public override List<CompNamed> GetNestedClasses() - { - return class_list; - } - - public override List<CompNamed> GetNestedInterfaces () - { - return interface_list; - } - - public override List<CompNamed> GetNestedStructs () - { - return struct_list; - } - - public override List<CompNamed> GetNestedEnums () - { - return enum_list; - } - - public override List<CompNamed> GetNestedDelegates () - { - return delegate_list; - } - - List<CompNamed> class_list; - List<CompNamed> interface_list; - List<CompNamed> struct_list; - List<CompNamed> delegate_list; - List<CompNamed> enum_list; - } - - public class CecilInterface : CompInterface { - public CecilInterface (TypeDefinition type_def) - : base (type_def.Name) - { - this.type_def = type_def; - - interfaces = new List<CompNamed>(); - constructors = new List<CompNamed>(); - methods = new List<CompNamed>(); - properties = new List<CompNamed>(); - fields = new List<CompNamed>(); - events = new List<CompNamed>(); - - CecilUtils.PopulateMemberLists (type_def, - interfaces, - constructors, - methods, - properties, - fields, - events); - - attributes = CecilUtils.GetCustomAttributes (type_def, todos); - } - - public CecilInterface (TypeReference type_ref) - : base (CecilUtils.FormatTypeLikeCorCompare (type_ref)) - { - interfaces = new List<CompNamed>(); - constructors = new List<CompNamed>(); - methods = new List<CompNamed>(); - properties = new List<CompNamed>(); - fields = new List<CompNamed>(); - events = new List<CompNamed>(); - - attributes = new List<CompNamed>(); - } - - public override string GetBaseType () - { - return (type_def == null || type_def.BaseType == null) ? null : CecilUtils.FormatTypeLikeCorCompare (type_def.BaseType); - } - - public override List<CompNamed> GetInterfaces () - { - return interfaces; - } - - public override List<CompNamed> GetMethods () - { - return methods; - } - - public override List<CompNamed> GetConstructors () - { - return constructors; - } - - public override List<CompNamed> GetProperties() - { - return properties; - } - - public override List<CompNamed> GetFields() - { - return fields; - } - - public override List<CompNamed> GetEvents() - { - return events; - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - List<CompNamed> interfaces; - List<CompNamed> constructors; - List<CompNamed> methods; - List<CompNamed> properties; - List<CompNamed> fields; - List<CompNamed> events; - List<CompNamed> attributes; - TypeDefinition type_def; - } - - public class CecilDelegate : CompDelegate { - public CecilDelegate (TypeDefinition type_def) - : base (type_def.Name) - { - this.type_def = type_def; - } - - public override string GetBaseType () - { - return type_def.BaseType == null ? null : CecilUtils.FormatTypeLikeCorCompare (type_def.BaseType); - } - - TypeDefinition type_def; - } - - public class CecilEnum : CompEnum { - public CecilEnum (TypeDefinition type_def) - : base (type_def.Name) - { - this.type_def = type_def; - - fields = new List<CompNamed>(); - - CecilUtils.PopulateMemberLists (type_def, - null, - null, - null, - null, - fields, - null); - - attributes = CecilUtils.GetCustomAttributes (type_def, todos); - } - - public override string GetBaseType () - { - return type_def.BaseType == null ? null : CecilUtils.FormatTypeLikeCorCompare (type_def.BaseType); - } - - public override List<CompNamed> GetFields() - { - return fields; - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - TypeDefinition type_def; - List<CompNamed> fields; - List<CompNamed> attributes; - } - - public class CecilClass : CompClass { - public CecilClass (TypeDefinition type_def, CompType type) - : base (type_def.Name, type) - { - this.type_def = type_def; - - nested_classes = new List<CompNamed>(); - nested_enums = new List<CompNamed>(); - nested_delegates = new List<CompNamed>(); - nested_interfaces = new List<CompNamed>(); - nested_structs = new List<CompNamed>(); - - CecilUtils.PopulateTypeLists (type_def, - nested_classes, - nested_enums, - nested_delegates, - nested_interfaces, - nested_structs); - - interfaces = new List<CompNamed>(); - constructors = new List<CompNamed>(); - methods = new List<CompNamed>(); - properties = new List<CompNamed>(); - fields = new List<CompNamed>(); - events = new List<CompNamed>(); - - CecilUtils.PopulateMemberLists (type_def, - interfaces, - constructors, - methods, - properties, - fields, - events); - - attributes = CecilUtils.GetCustomAttributes (type_def, todos); - } - - public override string GetBaseType () - { - return type_def.BaseType == null ? null : CecilUtils.FormatTypeLikeCorCompare (type_def.BaseType); - } - - public override List<CompNamed> GetInterfaces () - { - return interfaces; - } - - public override List<CompNamed> GetMethods () - { - return methods; - } - - public override List<CompNamed> GetConstructors () - { - return constructors; - } - - public override List<CompNamed> GetProperties() - { - return properties; - } - - public override List<CompNamed> GetFields() - { - return fields; - } - - public override List<CompNamed> GetEvents() - { - return events; - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - public override List<CompNamed> GetNestedClasses() - { - return nested_classes; - } - - public override List<CompNamed> GetNestedInterfaces () - { - return nested_interfaces; - } - - public override List<CompNamed> GetNestedStructs () - { - return nested_structs; - } - - public override List<CompNamed> GetNestedEnums () - { - return nested_enums; - } - - public override List<CompNamed> GetNestedDelegates () - { - return nested_delegates; - } - - TypeDefinition type_def; - List<CompNamed> nested_classes; - List<CompNamed> nested_interfaces; - List<CompNamed> nested_structs; - List<CompNamed> nested_delegates; - List<CompNamed> nested_enums; - - List<CompNamed> interfaces; - List<CompNamed> constructors; - List<CompNamed> methods; - List<CompNamed> properties; - List<CompNamed> fields; - List<CompNamed> events; - List<CompNamed> attributes; - } - - public class CecilField : CompField { - public CecilField (FieldDefinition field_def) - : base (field_def.Name) - { - this.field_def = field_def; - this.attributes = CecilUtils.GetCustomAttributes (field_def, todos); - } - - public override string GetMemberType () - { - return CecilUtils.FormatTypeLikeCorCompare (field_def.FieldType); - } - - const FieldAttributes masterInfoFieldMask = (FieldAttributes.FieldAccessMask | - FieldAttributes.Static | - FieldAttributes.InitOnly | - FieldAttributes.Literal | - FieldAttributes.HasDefault | - FieldAttributes.HasFieldMarshal | - FieldAttributes.NotSerialized ); - public override string GetMemberAccess () - { - FieldAttributes fa = field_def.Attributes & masterInfoFieldMask; - - // remove the Assem from FamORAssem - if ((fa & FieldAttributes.FamORAssem) == FieldAttributes.FamORAssem) - fa = (fa & ~(FieldAttributes.FamORAssem)) | (FieldAttributes.Family); - - return fa.ToString(); - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - public override string GetLiteralValue () - { - if (field_def.IsLiteral) - return field_def.Constant.ToString(); - return null; - } - - FieldDefinition field_def; - List<CompNamed> attributes; - } - - public class CecilMethod : CompMethod { - public CecilMethod (MethodDefinition method_def) - : base (FormatName (method_def, false)) - { - this.method_def = method_def; - this.attributes = CecilUtils.GetCustomAttributes (method_def, todos); - DisplayName = FormatName (method_def, true); - } - - public override string GetMemberType () - { - if (method_def.IsConstructor) - return null; - - return CecilUtils.FormatTypeLikeCorCompare (method_def.ReturnType.ReturnType); - } - - public override bool ThrowsNotImplementedException () - { - if (method_def.Body != null) - foreach (Instruction i in method_def.Body.Instructions) - if (i.OpCode == OpCodes.Throw) - if (i.Previous.Operand != null && i.Previous.Operand.ToString ().StartsWith ("System.Void System.NotImplementedException")) - return true; - - return false; - } - - const MethodAttributes masterInfoMethodMask = (MethodAttributes.MemberAccessMask | - MethodAttributes.Virtual | - MethodAttributes.Final | - MethodAttributes.Static | - MethodAttributes.Abstract | - MethodAttributes.HideBySig | - MethodAttributes.SpecialName); - public override string GetMemberAccess () - { - MethodAttributes ma = method_def.Attributes & masterInfoMethodMask; - - // remove the Assem from FamORAssem - if ((ma & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem) - ma = (ma & ~(MethodAttributes.FamORAssem)) | (MethodAttributes.Family); - - return ma.ToString(); - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - static string FormatName (MethodDefinition method_def, bool beautify) - { - StringBuilder sb = new StringBuilder (); - if (!method_def.IsConstructor) - sb.Append (beautify - ? CecilUtils.PrettyType (method_def.ReturnType.ReturnType) - : CecilUtils.FormatTypeLikeCorCompare (method_def.ReturnType.ReturnType)); - sb.Append (" "); - if (beautify) { - if (method_def.IsSpecialName && method_def.Name.StartsWith ("op_")) { - switch (method_def.Name) { - case "op_Explicit": sb.Append ("operator explicit"); break; - case "op_Implicit": sb.Append ("operator implicit"); break; - case "op_Equality": sb.Append ("operator =="); break; - case "op_Inequality": sb.Append ("operator !="); break; - case "op_Addition": sb.Append ("operator +"); break; - case "op_Subtraction": sb.Append ("operator -"); break; - case "op_Division": sb.Append ("operator /"); break; - case "op_Multiply": sb.Append ("operator *"); break; - case "op_Modulus": sb.Append ("operator %"); break; - case "op_GreaterThan": sb.Append ("operator >"); break; - case "op_GreaterThanOrEqual": sb.Append ("operator >="); break; - case "op_LessThan": sb.Append ("operator <"); break; - case "op_LessThanOrEqual": sb.Append ("operator <="); break; - case "op_UnaryNegation": sb.Append ("operator -"); break; - case "op_UnaryPlus": sb.Append ("operator +"); break; - case "op_Decrement": sb.Append ("operator --"); break; - case "op_Increment": sb.Append ("operator ++"); break; - default: Console.WriteLine ("unhandled operator named {0}", method_def.Name); sb.Append (method_def.Name); break; - } - } - else { - sb.Append (method_def.Name); - } - } - else { - sb.Append (method_def.Name); - } - if (beautify && method_def.GenericParameters.Count > 0) { - sb.Append ("<"); - bool first_gp = true; - foreach (GenericParameter gp in method_def.GenericParameters) { - if (!first_gp) - sb.Append (','); - first_gp = false; - sb.Append (gp.Name); - } - sb.Append (">"); - } - sb.Append ('('); - bool first_p = true; - foreach (ParameterDefinition p in method_def.Parameters) { - if (!first_p) - sb.Append (", "); - first_p = false; - if (p.IsIn) - sb.Append ("in "); - else if (p.IsOut) - sb.Append ("out "); - sb.Append (beautify - ? CecilUtils.PrettyType (p.ParameterType) - : CecilUtils.FormatTypeLikeCorCompare (p.ParameterType)); - if (beautify) { - sb.Append (" "); - sb.Append (p.Name); - } - } - sb.Append (')'); - - return sb.ToString(); - } - - MethodDefinition method_def; - List<CompNamed> attributes; - } - - public class CecilProperty : CompProperty - { - public CecilProperty (PropertyDefinition pd) - : base (FormatName (pd, false)) - { - this.pd = pd; - this.attributes = CecilUtils.GetCustomAttributes (pd, todos); - this.DisplayName = FormatName (pd, true); - } - - public override string GetMemberType() - { - return CecilUtils.FormatTypeLikeCorCompare (pd.PropertyType); - } - - public override string GetMemberAccess() - { - return pd.Attributes == 0 ? null : pd.Attributes.ToString(); - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - public override List<CompNamed> GetMethods() - { - List<CompNamed> rv = new List<CompNamed>(); - - if (pd.GetMethod != null && !pd.GetMethod.IsPrivate && !pd.GetMethod.IsAssembly) - rv.Add (new CecilMethod (pd.GetMethod)); - if (pd.SetMethod != null && !pd.SetMethod.IsPrivate && !pd.SetMethod.IsAssembly) - rv.Add (new CecilMethod (pd.SetMethod)); - - return rv; - } - - static string FormatName (PropertyDefinition pd, bool beautify) - { - StringBuilder sb = new StringBuilder (); - -#if INCLUDE_TYPE_IN_PROPERTY_DISPLAYNAME - sb.Append (beautify - ? CecilUtils.PrettyType (pd.PropertyType) - : CecilUtils.FormatTypeLikeCorCompare (pd.PropertyType)); - sb.Append (" "); -#else - if (!beautify) { - sb.Append (CecilUtils.FormatTypeLikeCorCompare (pd.PropertyType)); - sb.Append (" "); - } -#endif - sb.Append (pd.Name); - - if (pd.Parameters.Count > 0) { - sb.Append ('['); - bool first_p = true; - foreach (ParameterDefinition p in pd.Parameters) { - if (!first_p) - sb.Append (", "); - first_p = false; - sb.Append (beautify - ? CecilUtils.PrettyType (p.ParameterType) - : CecilUtils.FormatTypeLikeCorCompare (p.ParameterType)); - if (beautify) { - sb.Append (" "); - sb.Append (p.Name); - } - } - sb.Append (']'); - } - - return sb.ToString (); - } - - PropertyDefinition pd; - List<CompNamed> attributes; - } - - public class CecilEvent : CompEvent - { - public CecilEvent (EventDefinition ed) - : base (ed.Name) - { - this.ed = ed; - this.attributes = CecilUtils.GetCustomAttributes (ed, todos); - } - - public override string GetMemberType() - { - return CecilUtils.FormatTypeLikeCorCompare (ed.EventType); - } - - public override string GetMemberAccess() - { - return ed.Attributes == 0 ? "None" : ed.Attributes.ToString(); - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - EventDefinition ed; - List<CompNamed> attributes; - } - - public class CecilAttribute : CompAttribute - { - public CecilAttribute (CustomAttribute ca) - : base (ca.Constructor.DeclaringType.FullName) - { - this.ca = ca; - } - - CustomAttribute ca; - } -} diff --git a/mcs/tools/corcompare/CompareContext.cs b/mcs/tools/corcompare/CompareContext.cs deleted file mode 100644 index 000da5a94a7..00000000000 --- a/mcs/tools/corcompare/CompareContext.cs +++ /dev/null @@ -1,520 +0,0 @@ -// -// CompareContext.cs -// -// (C) 2007 - 2008 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.Threading; - -namespace GuiCompare { - - // A delegate used to load a CompAssembly - public delegate CompAssembly LoadCompAssembly (); - - public class CompareContext - { - LoadCompAssembly reference_loader, target_loader; - - public CompareContext (LoadCompAssembly reference, LoadCompAssembly target) - { - reference_loader = reference; - target_loader = target; - } - - public ComparisonNode Comparison { - get { return comparison; } - } - - public void Compare () - { - if (t != null) - throw new InvalidOperationException ("compare already running"); - - t = new Thread (CompareThread); - t.Start (); - } - - public void StopCompare () - { - } - - bool TryLoad (ref CompAssembly assembly, LoadCompAssembly loader) - { - try { - assembly = loader (); - return true; - } catch (Exception e) { - OnError (e.ToString ()); - return false; - } - } - - void CompareThread () - { - ProgressChange (Double.NaN, "Loading reference..."); - - if (!TryLoad (ref reference, reference_loader)) - return; - - ProgressChange (Double.NaN, "Loading target..."); - - if (!TryLoad (ref target, target_loader)) - return; - - ProgressChange (0.0, "Comparing..."); - - comparison = target.GetComparisonNode (); - - List<CompNamed> ref_namespaces = reference.GetNamespaces(); - - total_comparisons = CountComparisons (ref_namespaces); - comparisons_performed = 0; - - CompareTypeLists (comparison, reference.GetNamespaces(), target.GetNamespaces()); - - CompareAttributes (comparison, reference, target); - - Finish (); - } - - int total_comparisons; - int comparisons_performed; - - int CountComparisons (List<CompNamed> list) - { - int rv = 0; - foreach (CompNamed l in list) { - rv += CountComparisons (l); - } - return rv; - } - - int CountComparisons (CompNamed named) - { - int rv = 1; - if (named is ICompMemberContainer) { - ICompMemberContainer container = (ICompMemberContainer)named; - rv += CountComparisons (container.GetInterfaces()); - rv += CountComparisons (container.GetConstructors()); - rv += CountComparisons (container.GetMethods()); - rv += CountComparisons (container.GetProperties()); - rv += CountComparisons (container.GetFields()); - } - if (named is ICompTypeContainer) { - ICompTypeContainer container = (ICompTypeContainer)named; - rv += CountComparisons (container.GetNestedInterfaces()); - rv += CountComparisons (container.GetNestedClasses()); - rv += CountComparisons (container.GetNestedStructs()); - rv += CountComparisons (container.GetNestedEnums()); - rv += CountComparisons (container.GetNestedDelegates()); - } - if (named is ICompAttributeContainer) { - rv += CountComparisons (((ICompAttributeContainer)named).GetAttributes()); - } - return rv; - } - - void CompareNestedTypes (ComparisonNode parent, ICompTypeContainer reference_container, ICompTypeContainer target_container) - { - CompareTypeLists (parent, - reference_container.GetNestedInterfaces(), target_container.GetNestedInterfaces()); - CompareTypeLists (parent, - reference_container.GetNestedClasses(), target_container.GetNestedClasses()); - CompareTypeLists (parent, - reference_container.GetNestedStructs(), target_container.GetNestedStructs()); - CompareTypeLists (parent, - reference_container.GetNestedEnums(), target_container.GetNestedEnums()); - CompareTypeLists (parent, - reference_container.GetNestedDelegates(), target_container.GetNestedDelegates()); - } - - void CompareTypeLists (ComparisonNode parent, - List<CompNamed> reference_list, - List<CompNamed> target_list) - { - int m = 0, a = 0; - - reference_list.Sort (CompNamed.Compare); - target_list.Sort (CompNamed.Compare); - - while (m < reference_list.Count || a < target_list.Count) { - if (m == reference_list.Count) { - AddExtra (parent, target_list[a]); - a++; - continue; - } - else if (a == target_list.Count) { - AddMissing (parent, reference_list[m]); - m++; - continue; - } - - int c = String.Compare (reference_list[m].Name, target_list[a].Name); - comparisons_performed ++; - - if (c == 0) { - ProgressChange ((double)comparisons_performed / total_comparisons * 100.0, String.Format ("Comparing {0} {1}", reference_list[m].Type, reference_list[m].Name)); - - /* the names match, further investigation is required */ - ComparisonNode comparison = target_list[a].GetComparisonNode(); - parent.AddChild (comparison); - - // compare base types - if (reference_list[m] is ICompHasBaseType && target_list[a] is ICompHasBaseType) { - if (((ICompHasBaseType)reference_list[m]).GetBaseType() != - ((ICompHasBaseType)target_list[a]).GetBaseType()) { - comparison.AddError (String.Format ("reference type {0} has base class of {1}, target has base class of {2}", - reference_list[m].Name, - ((ICompHasBaseType)reference_list[m]).GetBaseType(), - ((ICompHasBaseType)target_list[a]).GetBaseType())); - } - } - - // compare nested types - if (reference_list[m] is ICompTypeContainer && target_list[a] is ICompTypeContainer) { - CompareNestedTypes (comparison, - (ICompTypeContainer)reference_list[m], - (ICompTypeContainer)target_list[a]); - } - if (reference_list[m] is ICompMemberContainer && target_list[a] is ICompMemberContainer) { - CompareMembers (comparison, - (ICompMemberContainer)reference_list[m], - (ICompMemberContainer)target_list[a]); - } - - m++; - a++; - } - else if (c < 0) { - /* reference name is before target name, reference name is missing from target */ - AddMissing (parent, reference_list[m]); - m++; - } - else { - /* reference name is after target name, target name is extra */ - AddExtra (parent, target_list[a]); - a++; - } - } - } - - void CompareAttributes (ComparisonNode parent, - ICompAttributeContainer reference_container, ICompAttributeContainer target_container) - { - int m = 0, a = 0; - - List<CompNamed> reference_attrs = reference_container.GetAttributes (); - List<CompNamed> target_attrs = target_container.GetAttributes (); - - reference_attrs.Sort (CompNamed.Compare); - target_attrs.Sort (CompNamed.Compare); - - while (m < reference_attrs.Count || a < target_attrs.Count) { - if (m == reference_attrs.Count) { - AddExtra (parent, target_attrs[a]); - a++; - continue; - } - else if (a == target_attrs.Count) { - AddMissing (parent, reference_attrs[m]); - m++; - continue; - } - - int c = String.Compare (reference_attrs[m].Name, target_attrs[a].Name); - comparisons_performed ++; - - if (c == 0) { - /* the names match, further investigation is required */ -// Console.WriteLine ("method {0} is in both, doing more comparisons", reference_list[m].Name); - ComparisonNode comparison = target_attrs[a].GetComparisonNode(); - parent.AddChild (comparison); - //CompareParameters (comparison, reference_list[m], target_namespace [target_list[a]]); - m++; - a++; - } - else if (c < 0) { - /* reference name is before target name, reference name is missing from target */ - AddMissing (parent, reference_attrs[m]); - m++; - } - else { - /* reference name is after target name, target name is extra */ - AddExtra (parent, target_attrs[a]); - a++; - } - } - } - - void CompareMembers (ComparisonNode parent, - ICompMemberContainer reference_container, ICompMemberContainer target_container) - { - CompareMemberLists (parent, - reference_container.GetInterfaces(), target_container.GetInterfaces()); - CompareMemberLists (parent, - reference_container.GetConstructors(), target_container.GetConstructors()); - CompareMemberLists (parent, - reference_container.GetMethods(), target_container.GetMethods()); - CompareMemberLists (parent, - reference_container.GetProperties(), target_container.GetProperties()); - CompareMemberLists (parent, - reference_container.GetFields(), target_container.GetFields()); - CompareMemberLists (parent, - reference_container.GetEvents(), target_container.GetEvents()); - } - - void CompareMemberLists (ComparisonNode parent, - List<CompNamed> reference_list, - List<CompNamed> target_list) - { - int m = 0, a = 0; - - reference_list.Sort (CompNamed.Compare); - target_list.Sort (CompNamed.Compare); - - while (m < reference_list.Count || a < target_list.Count) { - if (m == reference_list.Count) { - AddExtra (parent, target_list[a]); - a++; - continue; - } - else if (a == target_list.Count) { - AddMissing (parent, reference_list[m]); - m++; - continue; - } - - int c = String.Compare (reference_list[m].Name, target_list[a].Name); - comparisons_performed ++; - - if (c == 0) { - /* the names match, further investigation is required */ -// Console.WriteLine ("method {0} is in both, doing more comparisons", reference_list[m].Name); - ComparisonNode comparison = target_list[a].GetComparisonNode(); - parent.AddChild (comparison); - - if (reference_list[m] is CompMember && target_list[a] is CompMember) { - string reference_type = ((CompMember)reference_list[m]).GetMemberType(); - string target_type = ((CompMember)target_list[a]).GetMemberType(); - - if (reference_type != target_type) { - comparison.AddError (String.Format ("reference type is <i>{0}</i>, target type is <i>{1}</i>", - reference_type, target_type)); - } - - string reference_access = ((CompMember)reference_list[m]).GetMemberAccess(); - string target_access = ((CompMember)target_list[a]).GetMemberAccess(); - if (reference_access != target_access) { - // Try to give some hints to the developer, best we can do with - // strings. - string extra_msg = ""; - if (reference_access.IndexOf ("Public, Final, Virtual, HideBySig") != -1 && - target_access.IndexOf ("Public, HideBySig") != -1){ - extra_msg = "\n\t\t<b>Hint:</b> reference uses an implicit interface implementation, target doesn't"; - } - - comparison.AddError (String.Format ("reference access is '<i>{0}</i>', target access is '<i>{1}</i>'{2}", - reference_access, target_access, extra_msg)); - comparison.status = ComparisonStatus.Error; - } - } - - if (reference_list[m] is CompMethod) { - if (((CompMethod)target_list[a]).ThrowsNotImplementedException () - && !((CompMethod)reference_list[m]).ThrowsNotImplementedException ()) { - - comparison.throws_niex = true; - } - } - - if (reference_list[m] is CompField) { - if (((CompField)reference_list[m]).GetLiteralValue() != - ((CompField)target_list[a]).GetLiteralValue()) { - comparison.AddError (String.Format ("reference field has value {0}, target field has value {1}", - ((CompField)reference_list[m]).GetLiteralValue(), - ((CompField)target_list[a]).GetLiteralValue())); - comparison.status = ComparisonStatus.Error; - } - } - - if (reference_list[m] is ICompAttributeContainer) { - //Console.WriteLine ("Comparing attributes for {0}", reference_list[m].Name); - CompareAttributes (comparison, - (ICompAttributeContainer)reference_list[m], - (ICompAttributeContainer)target_list[a]); - } - - if (reference_list[m] is ICompMemberContainer) { - CompareMembers (comparison, - (ICompMemberContainer)reference_list[m], - (ICompMemberContainer)target_list[a]); - } - - //CompareParameters (comparison, reference_list[m], target_namespace [target_list[a]]); - m++; - a++; - } - else if (c < 0) { - /* reference name is before target name, reference name is missing from target */ - AddMissing (parent, reference_list[m]); - m++; - } - else { - /* reference name is after target name, target name is extra */ - AddExtra (parent, target_list[a]); - a++; - } - } - } - - void AddExtra (ComparisonNode parent, CompNamed item) - { - ComparisonNode node = item.GetComparisonNode (); - parent.AddChild (node); - node.status = ComparisonStatus.Extra; - - if (item is ICompTypeContainer) { - ICompTypeContainer c = (ICompTypeContainer)item; - foreach (CompNamed ifc in c.GetNestedInterfaces ()) - AddExtra (node, ifc); - foreach (CompNamed cls in c.GetNestedClasses()) - AddExtra (node, cls); - foreach (CompNamed cls in c.GetNestedStructs()) - AddExtra (node, cls); - foreach (CompNamed en in c.GetNestedEnums()) - AddExtra (node, en); - } - } - - void AddMissing (ComparisonNode parent, CompNamed item) - { - ComparisonNode node = item.GetComparisonNode (); - parent.AddChild (node); - node.status = ComparisonStatus.Missing; - - comparisons_performed ++; - - if (item is ICompTypeContainer) { - ICompTypeContainer c = (ICompTypeContainer)item; - - foreach (CompNamed ifc in c.GetNestedInterfaces ()) - AddMissing (node, ifc); - foreach (CompNamed cls in c.GetNestedClasses()) - AddMissing (node, cls); - foreach (CompNamed cls in c.GetNestedStructs()) - AddMissing (node, cls); - foreach (CompNamed en in c.GetNestedEnums()) - AddMissing (node, en); - } - if (item is ICompMemberContainer) { - ICompMemberContainer c = (ICompMemberContainer)item; - foreach (CompNamed ifc in c.GetInterfaces()) - AddMissing (node, ifc); - foreach (CompNamed m in c.GetConstructors()) - AddMissing (node, m); - foreach (CompNamed m in c.GetMethods()) - AddMissing (node, m); - foreach (CompNamed p in c.GetProperties()) - AddMissing (node, p); - foreach (CompNamed f in c.GetFields()) - AddMissing (node, f); - foreach (CompNamed e in c.GetEvents()) - AddMissing (node, e); - } - if (item is ICompAttributeContainer) { - ICompAttributeContainer c = (ICompAttributeContainer)item; - foreach (CompNamed attr in c.GetAttributes()) - AddMissing (node, attr); - } - } - - // This is the reference assembly that we will be comparing to. - CompAssembly reference; - - // This is the new API. - CompAssembly target; - - void ProgressChange (double progress, string message) - { - if (ProgressChanged != null) - ProgressChanged (this, new CompareProgressChangedEventArgs (message, progress)); - } - - void OnError (string message) - { - if (Error != null) - Error (this, new CompareErrorEventArgs (message)); - } - - void Finish () - { - if (Finished != null) - Finished (this, EventArgs.Empty); - } - - public event CompareProgressChangedEventHandler ProgressChanged; - public event CompareErrorEventHandler Error; - public event EventHandler Finished; - - ComparisonNode comparison; - Thread t; - } - - public delegate void CompareProgressChangedEventHandler (object sender, CompareProgressChangedEventArgs args); - public delegate void CompareErrorEventHandler (object sender, CompareErrorEventArgs args); - - public class CompareProgressChangedEventArgs : EventArgs - { - public CompareProgressChangedEventArgs (string message, double progress) - { - this.message = message; - this.progress = progress; - } - - public string Message { - get { return message; } - } - - public double Progress { - get { return progress; } - } - - string message; - double progress; - } - - public class CompareErrorEventArgs : EventArgs - { - public CompareErrorEventArgs (string message) - { - this.message = message; - } - - public string Message { - get { return message; } - } - - string message; - } -} diff --git a/mcs/tools/corcompare/Comparison.cs b/mcs/tools/corcompare/Comparison.cs deleted file mode 100644 index 2097accb922..00000000000 --- a/mcs/tools/corcompare/Comparison.cs +++ /dev/null @@ -1,95 +0,0 @@ -// -// Comparison.cs -// -// (C) 2007 - 2008 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; - -namespace GuiCompare { - - public enum ComparisonStatus { - None, - Missing, - Extra, - Error - } - - public class ComparisonNode { - public ComparisonNode (CompType type, - string name) - { - this.type = type; - this.name = name; - this.children = new List<ComparisonNode>(); - this.messages = new List<string>(); - this.todos = new List<string>(); - } - - public void AddChild (ComparisonNode node) - { - children.Add (node); - node.parent = this; - } - - public void PropagateCounts () - { - Todo = todos.Count; - Niex = throws_niex ? 1 : 0; - foreach (ComparisonNode n in children) { - n.PropagateCounts (); - Extra += n.Extra + (n.status == ComparisonStatus.Extra ? 1 : 0); - Missing += n.Missing + (n.status == ComparisonStatus.Missing ? 1 : 0); - Present += n.Present; // XXX - Todo += n.Todo; - Niex += n.Niex; - Warning += n.Warning + (n.status == ComparisonStatus.Error ? 1 : 0); - } - } - - public void AddError (string msg) - { - status = ComparisonStatus.Error; - messages.Add (msg); - } - - public ComparisonStatus status; - public CompType type; - - public ComparisonNode parent; - - public string name; - public List<string> messages; - public List<string> todos; - public bool throws_niex; - - public int Extra; - public int Missing; - public int Present; - public int Warning; - public int Todo; - public int Niex; - - public List<ComparisonNode> children; - } -} diff --git a/mcs/tools/corcompare/MasterMetadata.cs b/mcs/tools/corcompare/MasterMetadata.cs deleted file mode 100644 index baa3df73ed9..00000000000 --- a/mcs/tools/corcompare/MasterMetadata.cs +++ /dev/null @@ -1,692 +0,0 @@ -// -// MasterMetadata.cs -// -// (C) 2007 - 2008 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.Text; - -namespace GuiCompare { - - static class MasterUtils { - public static void PopulateMethodList (XMLMethods methods, List<CompNamed> method_list) - { - foreach (object key in methods.keys.Keys) { - XMLMethods.SignatureFlags signatureFlags = (methods.signatureFlags != null && - methods.signatureFlags.ContainsKey (key) ? - (XMLMethods.SignatureFlags) methods.signatureFlags [key] : - XMLMethods.SignatureFlags.None); - - XMLParameters parameters = (methods.parameters == null ? null - : (XMLParameters)methods.parameters[key]); - XMLGenericParameters genericParameters = (methods.genericParameters == null ? null - : (XMLGenericParameters)methods.genericParameters[key]); - XMLAttributes attributes = (methods.attributeMap == null ? null - : (XMLAttributes)methods.attributeMap[key]); - string returnType = (methods.returnTypes == null ? null - : (string)methods.returnTypes[key]); - method_list.Add (new MasterMethod ((string)methods.keys[key], - signatureFlags, - returnType, - parameters, - genericParameters, - methods.ConvertToString (Int32.Parse ((string)methods.access[key])), - attributes)); - } - } - - public static void PopulateMemberLists (XMLClass xml_cls, - List<CompNamed> interface_list, - List<CompNamed> constructor_list, - List<CompNamed> method_list, - List<CompNamed> property_list, - List<CompNamed> field_list, - List<CompNamed> event_list) - { - if (interface_list != null && xml_cls.interfaces != null) { - foreach (object i in xml_cls.interfaces.keys.Keys) { - interface_list.Add (new MasterInterface ((string)xml_cls.interfaces.keys[i])); - } - } - - if (constructor_list != null && xml_cls.constructors != null) { - PopulateMethodList (xml_cls.constructors, constructor_list); - } - - if (method_list != null && xml_cls.methods != null) { - PopulateMethodList (xml_cls.methods, method_list); - } - - if (property_list != null && xml_cls.properties != null) { - foreach (object key in xml_cls.properties.keys.Keys) { - XMLAttributes attributes = (xml_cls.properties.attributeMap == null ? null - : (XMLAttributes)xml_cls.properties.attributeMap[key]); - - property_list.Add (new MasterProperty ((string)key, - xml_cls.properties.ConvertToString (Int32.Parse ((string)xml_cls.properties.access[key])), - (XMLMethods)xml_cls.properties.nameToMethod[key], - attributes)); - } - } - - if (field_list != null && xml_cls.fields != null) { - foreach (object key in xml_cls.fields.keys.Keys) { - string type = (xml_cls.fields.fieldTypes == null || !xml_cls.fields.fieldTypes.ContainsKey(key)) ? null : (string)xml_cls.fields.fieldTypes[key]; - string fvalue = (xml_cls.fields.fieldValues == null || !xml_cls.fields.fieldValues.ContainsKey(key)) ? null : (string)xml_cls.fields.fieldValues[key]; - XMLAttributes attributes = (xml_cls.fields.attributeMap == null ? null - : (XMLAttributes)xml_cls.fields.attributeMap[key]); - - field_list.Add (new MasterField ((string)xml_cls.fields.keys[key], - type, fvalue, - xml_cls.fields.ConvertToString(Int32.Parse ((string)xml_cls.fields.access[key])), - attributes)); - } - } - - if (event_list != null && xml_cls.events != null) { - foreach (object key in xml_cls.events.keys.Keys) { - XMLAttributes attributes = (xml_cls.events.attributeMap == null ? null - : (XMLAttributes)xml_cls.events.attributeMap[key]); - event_list.Add (new MasterEvent ((string)xml_cls.events.keys[key], - (string)xml_cls.events.eventTypes[key], - xml_cls.events.ConvertToString (Int32.Parse ((string)xml_cls.events.access[key])), - attributes)); - } - } - } - - - public static void PopulateTypeLists (XMLClass fromDef, - List<CompNamed> class_list, - List<CompNamed> enum_list, - List<CompNamed> delegate_list, - List<CompNamed> interface_list, - List<CompNamed> struct_list) - { - if (fromDef.nested == null) - return; - - foreach (XMLClass cls in fromDef.nested) { - if (cls.type == "class") - class_list.Add (new MasterClass (cls, CompType.Class)); - else if (cls.type == "enum") - enum_list.Add (new MasterEnum (cls)); - else if (cls.type == "delegate") - delegate_list.Add (new MasterDelegate (cls)); - else if (cls.type == "interface") - interface_list.Add (new MasterInterface (cls)); - else if (cls.type == "struct") - struct_list.Add (new MasterClass (cls, CompType.Struct)); - } - } - - public static bool ShouldSkipAttribute (string name) - { - if (name.StartsWith ("System.Diagnostics.CodeAnalysis.SuppressMessageAttribute") - || name == "System.NonSerializedAttribute") - return true; - - return false; - } - - public static List<CompNamed> GetAttributes (XMLAttributes attributes) - { - List<CompNamed> rv = new List<CompNamed>(); - if (attributes != null) { - foreach (object key in attributes.keys.Keys) { - if (ShouldSkipAttribute ((string)key)) - continue; - rv.Add (new MasterAttribute ((string)attributes.keys[key])); - } - } - return rv; - } - - } - - public class MasterAssembly : CompAssembly { - public MasterAssembly (string path) - : base (path) - { - masterinfo = XMLAssembly.CreateFromFile (path); - attributes = MasterUtils.GetAttributes (masterinfo.attributes); - } - - public override List<CompNamed> GetNamespaces () - { - List<CompNamed> namespaces = new List<CompNamed>(); - if (masterinfo != null && masterinfo.namespaces != null) { - foreach (XMLNamespace ns in masterinfo.namespaces) - namespaces.Add (new MasterNamespace (ns)); - } - - return namespaces; - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - XMLAssembly masterinfo; - List<CompNamed> attributes; - } - - public class MasterNamespace : CompNamespace { - public MasterNamespace (XMLNamespace ns) - : base (ns.name) - { - this.ns = ns; - - delegate_list = new List<CompNamed>(); - enum_list = new List<CompNamed>(); - class_list = new List<CompNamed>(); - struct_list = new List<CompNamed>(); - interface_list = new List<CompNamed>(); - - foreach (XMLClass cls in ns.types) { - if (cls.type == "class") - class_list.Add (new MasterClass (cls, CompType.Class)); - else if (cls.type == "enum") - enum_list.Add (new MasterEnum (cls)); - else if (cls.type == "delegate") - delegate_list.Add (new MasterDelegate (cls)); - else if (cls.type == "interface") - interface_list.Add (new MasterInterface (cls)); - else if (cls.type == "struct") - struct_list.Add (new MasterClass (cls, CompType.Struct)); - } - } - - public override List<CompNamed> GetNestedClasses () - { - return class_list; - } - - public override List<CompNamed> GetNestedInterfaces () - { - return interface_list; - } - - public override List<CompNamed> GetNestedStructs () - { - return struct_list; - } - - public override List<CompNamed> GetNestedEnums () - { - return enum_list; - } - - public override List<CompNamed> GetNestedDelegates () - { - return delegate_list; - } - - XMLNamespace ns; - List<CompNamed> delegate_list; - List<CompNamed> enum_list; - List<CompNamed> class_list; - List<CompNamed> struct_list; - List<CompNamed> interface_list; - } - - public class MasterInterface : CompInterface { - public MasterInterface (XMLClass xml_cls) - : base (xml_cls.name) - { - this.xml_cls = xml_cls; - - interfaces = new List<CompNamed>(); - constructors = new List<CompNamed>(); - methods = new List<CompNamed>(); - properties = new List<CompNamed>(); - fields = new List<CompNamed>(); - events = new List<CompNamed>(); - - MasterUtils.PopulateMemberLists (xml_cls, - interfaces, - constructors, - methods, - properties, - fields, - events); - - attributes = MasterUtils.GetAttributes (xml_cls.attributes); - } - - public MasterInterface (string name) - : base (name) - { - interfaces = new List<CompNamed>(); - constructors = new List<CompNamed>(); - methods = new List<CompNamed>(); - properties = new List<CompNamed>(); - fields = new List<CompNamed>(); - events = new List<CompNamed>(); - attributes = new List<CompNamed>(); - } - - public override string GetBaseType() - { - return xml_cls == null ? null : xml_cls.baseName; - } - - public override List<CompNamed> GetInterfaces () - { - return interfaces; - } - - public override List<CompNamed> GetMethods () - { - return methods; - } - - public override List<CompNamed> GetConstructors () - { - return constructors; - } - - public override List<CompNamed> GetProperties() - { - return properties; - } - - public override List<CompNamed> GetFields() - { - return fields; - } - - public override List<CompNamed> GetEvents() - { - return events; - } - - public override List<CompNamed> GetAttributes () - { - return attributes; - } - - XMLClass xml_cls; - List<CompNamed> interfaces; - List<CompNamed> constructors; - List<CompNamed> methods; - List<CompNamed> properties; - List<CompNamed> fields; - List<CompNamed> events; - List<CompNamed> attributes; - } - - public class MasterDelegate : CompDelegate { - public MasterDelegate (XMLClass cls) - : base (cls.name) - { - xml_cls = cls; - } - - public override string GetBaseType () - { - return xml_cls.baseName; - } - - XMLClass xml_cls; - } - - public class MasterEnum : CompEnum { - public MasterEnum (XMLClass cls) - : base (cls.name) - { - xml_cls = cls; - - fields = new List<CompNamed>(); - - MasterUtils.PopulateMemberLists (xml_cls, - null, - null, - null, - null, - fields, - null); - - } - - public override string GetBaseType() - { - return xml_cls.baseName; - } - - public override List<CompNamed> GetFields() - { - return fields; - } - - public override List<CompNamed> GetAttributes () - { - return MasterUtils.GetAttributes (xml_cls.attributes); - } - - List<CompNamed> fields; - XMLClass xml_cls; - } - - public class MasterClass : CompClass { - public MasterClass (XMLClass cls, CompType type) - : base (cls.name, type) - { - xml_cls = cls; - - interfaces = new List<CompNamed>(); - constructors = new List<CompNamed>(); - methods = new List<CompNamed>(); - properties = new List<CompNamed>(); - fields = new List<CompNamed>(); - events = new List<CompNamed>(); - - MasterUtils.PopulateMemberLists (xml_cls, - interfaces, - constructors, - methods, - properties, - fields, - events); - - delegate_list = new List<CompNamed>(); - enum_list = new List<CompNamed>(); - class_list = new List<CompNamed>(); - struct_list = new List<CompNamed>(); - interface_list = new List<CompNamed>(); - - MasterUtils.PopulateTypeLists (xml_cls, - class_list, - enum_list, - delegate_list, - interface_list, - struct_list); - } - - public override string GetBaseType () - { - return xml_cls.baseName; - } - - public override List<CompNamed> GetInterfaces () - { - return interfaces; - } - - public override List<CompNamed> GetMethods() - { - return methods; - } - - public override List<CompNamed> GetConstructors() - { - return constructors; - } - - public override List<CompNamed> GetProperties() - { - return properties; - } - - public override List<CompNamed> GetFields() - { - return fields; - } - - public override List<CompNamed> GetEvents() - { - return events; - } - - public override List<CompNamed> GetAttributes () - { - return MasterUtils.GetAttributes (xml_cls.attributes); - } - - public override List<CompNamed> GetNestedClasses() - { - return class_list; - } - - public override List<CompNamed> GetNestedInterfaces () - { - return interface_list; - } - - public override List<CompNamed> GetNestedStructs () - { - return struct_list; - } - - public override List<CompNamed> GetNestedEnums () - { - return enum_list; - } - - public override List<CompNamed> GetNestedDelegates () - { - return delegate_list; - } - - XMLClass xml_cls; - - List<CompNamed> interfaces; - List<CompNamed> constructors; - List<CompNamed> methods; - List<CompNamed> properties; - List<CompNamed> fields; - List<CompNamed> events; - - List<CompNamed> delegate_list; - List<CompNamed> enum_list; - List<CompNamed> class_list; - List<CompNamed> struct_list; - List<CompNamed> interface_list; -} - - public class MasterEvent : CompEvent { - public MasterEvent (string name, - string eventType, - string eventAccess, - XMLAttributes attributes) - : base (name) - { - this.eventType = eventType; - this.eventAccess = eventAccess; - this.attributes = attributes; - } - - public override string GetMemberType () - { - return eventType; - } - - public override string GetMemberAccess () - { - return eventAccess; - } - - public override List<CompNamed> GetAttributes () - { - return MasterUtils.GetAttributes (attributes); - } - - string eventType; - string eventAccess; - XMLAttributes attributes; - } - - - public class MasterField : CompField { - public MasterField (string name, - string fieldType, - string fieldValue, - string fieldAccess, - XMLAttributes attributes) - : base (name) - { - this.fieldType = fieldType; - this.fieldValue = fieldValue; - // we don't care about the Assembly (internal) part - this.fieldAccess = fieldAccess.Replace ("FamORAssem", "Family"); - this.attributes = attributes; - } - - public override string GetMemberType () - { - return fieldType; - } - - public override string GetMemberAccess () - { - return fieldAccess; - } - - public override List<CompNamed> GetAttributes () - { - return MasterUtils.GetAttributes (attributes); - } - - public override string GetLiteralValue () - { - return fieldValue; - } - - string fieldType; - string fieldValue; - string fieldAccess; - XMLAttributes attributes; - } - - public class MasterProperty : CompProperty { - public MasterProperty (string key, string propertyAccess, XMLMethods xml_methods, XMLAttributes attributes) - : base (FormatName (key)) - { - string[] keyparts = key.Split(new char[] {':'}, 3); - - this.propertyType = keyparts[1]; - this.propertyAccess = propertyAccess; - - methods = new List<CompNamed>(); - - MasterUtils.PopulateMethodList (xml_methods, methods); - this.attributes = attributes; - } - - public override List<CompNamed> GetAttributes () - { - return MasterUtils.GetAttributes (attributes); - } - - public override string GetMemberType() - { - return propertyType; - } - - public override string GetMemberAccess() - { - return propertyAccess; - } - - public override List<CompNamed> GetMethods() - { - return methods; - } - - static string FormatName (string key) - { - string[] keyparts = key.Split(new char[] {':'}, 3); - - StringBuilder sb = new StringBuilder (); - sb.Append (keyparts[1]); - sb.Append (" "); - sb.Append (keyparts[0]); - - if (keyparts[2] != "") - sb.AppendFormat ("[{0}]", keyparts[2]); - - return sb.ToString (); - } - - List<CompNamed> methods; - XMLAttributes attributes; - string propertyType; - string propertyAccess; - } - - public class MasterMethod : CompMethod { - public MasterMethod (string name, - XMLMethods.SignatureFlags signatureFlags, - string returnType, - XMLParameters parameters, - XMLGenericParameters genericParameters, - string methodAccess, - XMLAttributes attributes) - : base (String.Format ("{0} {1}", returnType, name)) - { - this.signatureFlags = signatureFlags; - this.returnType = returnType; - this.parameters = parameters; - this.genericParameters = genericParameters; - // we don't care about the Assembly (internal) part - this.methodAccess = methodAccess.Replace ("FamORAssem", "Family"); - this.attributes = attributes; - } - - public override string GetMemberType() - { - return returnType; - } - - public override bool ThrowsNotImplementedException () - { - return false; - } - - public override string GetMemberAccess() - { - return methodAccess; - } - - public override List<CompNamed> GetAttributes () - { - return MasterUtils.GetAttributes (attributes); - } - - XMLMethods.SignatureFlags signatureFlags; - string returnType; - XMLParameters parameters; - XMLGenericParameters genericParameters; - string methodAccess; - XMLAttributes attributes; - } - - public class MasterAttribute : CompAttribute { - public MasterAttribute (string name) - : base (name) - { - } - } -} diff --git a/mcs/tools/corcompare/Masterinfo.cs b/mcs/tools/corcompare/Masterinfo.cs deleted file mode 100644 index 24b24789280..00000000000 --- a/mcs/tools/corcompare/Masterinfo.cs +++ /dev/null @@ -1,1067 +0,0 @@ -// -// Masterinfo.cs -// -// Authors: -// Gonzalo Paniagua Javier (gonzalo@ximian.com) -// Marek Safar (marek.safar@gmail.com) -// -// (C) 2003 - 2008 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; -using System.Reflection; -using System.Text; -using System.Xml; - -namespace GuiCompare { - - public class Counters - { - public int Present; - public int PresentTotal; - public int Missing; - public int MissingTotal; - public int Todo; - public int TodoTotal; - - public int Extra; - public int ExtraTotal; - public int Warning; - public int WarningTotal; - public int ErrorTotal; - - public Counters () - { - } - - public void AddPartialToPartial (Counters other) - { - Present += other.Present; - Extra += other.Extra; - Missing += other.Missing; - - Todo += other.Todo; - Warning += other.Warning; - AddPartialToTotal (other); - } - - public void AddPartialToTotal (Counters other) - { - PresentTotal += other.Present; - ExtraTotal += other.Extra; - MissingTotal += other.Missing; - - TodoTotal += other.Todo; - WarningTotal += other.Warning; - } - - public void AddTotalToPartial (Counters other) - { - Present += other.PresentTotal; - Extra += other.ExtraTotal; - Missing += other.MissingTotal; - - Todo += other.TodoTotal; - Warning += other.WarningTotal; - AddTotalToTotal (other); - } - - public void AddTotalToTotal (Counters other) - { - PresentTotal += other.PresentTotal; - ExtraTotal += other.ExtraTotal; - MissingTotal += other.MissingTotal; - - TodoTotal += other.TodoTotal; - WarningTotal += other.WarningTotal; - ErrorTotal += other.ErrorTotal; - } - - public int Total { - get { return Present + Missing; } - } - - public int AbsTotal { - get { return PresentTotal + MissingTotal; } - } - - public int Ok { - get { return Present - Todo; } - } - - public int OkTotal { - get { return PresentTotal - TodoTotal - ErrorTotal; } - } - - public override string ToString () - { - StringWriter sw = new StringWriter (); - sw.WriteLine ("Present: {0}", Present); - sw.WriteLine ("PresentTotal: {0}", PresentTotal); - sw.WriteLine ("Missing: {0}", Missing); - sw.WriteLine ("MissingTotal: {0}", MissingTotal); - sw.WriteLine ("Todo: {0}", Todo); - sw.WriteLine ("TodoTotal: {0}", TodoTotal); - sw.WriteLine ("Extra: {0}", Extra); - sw.WriteLine ("ExtraTotal: {0}", ExtraTotal); - sw.WriteLine ("Warning: {0}", Warning); - sw.WriteLine ("WarningTotal: {0}", WarningTotal); - sw.WriteLine ("ErrorTotal: {0}", ErrorTotal); - sw.WriteLine ("--"); - return sw.GetStringBuilder ().ToString (); - } - } - - public abstract class XMLData - { - protected XmlDocument document; - protected Counters counters; - bool haveWarnings; - - public XMLData () - { - counters = new Counters (); - } - - public virtual void LoadData (XmlNode node) - { - } - - protected object [] LoadRecursive (XmlNodeList nodeList, Type type) - { - ArrayList list = new ArrayList (); - foreach (XmlNode node in nodeList) { - XMLData data = (XMLData) Activator.CreateInstance (type); - data.LoadData (node); - list.Add (data); - } - - return (object []) list.ToArray (type); - } - - public static bool IsMonoTODOAttribute (string s) - { - if (s == null) - return false; - if (//s.EndsWith ("MonoTODOAttribute") || - s.EndsWith ("MonoDocumentationNoteAttribute") || - s.EndsWith ("MonoExtensionAttribute") || -// s.EndsWith ("MonoInternalNoteAttribute") || - s.EndsWith ("MonoLimitationAttribute") || - s.EndsWith ("MonoNotSupportedAttribute")) - return true; - return s.EndsWith ("TODOAttribute"); - } - - protected void AddAttribute (XmlNode node, string name, string value) - { - XmlAttribute attr = document.CreateAttribute (name); - attr.Value = value; - node.Attributes.Append (attr); - } - - public Counters Counters { - get { return counters; } - } - } - - public abstract class XMLNameGroup : XMLData - { - protected XmlNode group; - public Hashtable keys; - - public override void LoadData (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - - if (node.Name != GroupName) - throw new FormatException (String.Format ("Expecting <{0}>", GroupName)); - - keys = new Hashtable (); - foreach (XmlNode n in node.ChildNodes) { - string name = n.Attributes ["name"].Value; - if (CheckIfAdd (name, n)) { - string key = GetNodeKey (name, n); - //keys.Add (key, name); - keys [key] = name; - LoadExtraData (key, n); - } - } - } - - protected virtual bool CheckIfAdd (string value, XmlNode node) - { - return true; - } - - protected virtual void LoadExtraData (string name, XmlNode node) - { - } - - public virtual string GetNodeKey (string name, XmlNode node) - { - return name; - } - - public virtual bool HasKey (string key, Hashtable other) - { - return other.ContainsKey (key); - } - - public abstract string GroupName { get; } - public abstract string Name { get; } - } - - public class XMLAssembly : XMLData - { - public XMLAttributes attributes; - public XMLNamespace [] namespaces; - string name; - string version; - - public static XMLAssembly CreateFromFile (string file) - { - XmlDocument doc = new XmlDocument (); - doc.Load (File.OpenRead (file)); - - XmlNode node = doc.SelectSingleNode ("/assemblies/assembly"); - if (node != null) { - XMLAssembly result = new XMLAssembly (); - try { - result.LoadData (node); - } catch (Exception e) { - Console.Error.WriteLine ("Error loading {0}: {1}\n{2}", file, e.Message, e); - return null; - } - return result; - } - - return null; - } - - public override void LoadData (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - - name = node.Attributes ["name"].Value; - version = node.Attributes ["version"].Value; - XmlNode atts = node.FirstChild; - attributes = new XMLAttributes (); - if (atts.Name == "attributes") { - attributes.LoadData (atts); - atts = atts.NextSibling; - } - - if (atts == null || atts.Name != "namespaces") { - Console.Error.WriteLine ("Warning: no namespaces found!"); - return; - } - - namespaces = (XMLNamespace []) LoadRecursive (atts.ChildNodes, typeof (XMLNamespace)); - } - - static Hashtable CreateHash (XMLNamespace [] other) - { - Hashtable result = new Hashtable (); - if (other != null) { - int i = 0; - foreach (XMLNamespace n in other) { - result [n.Name] = i++; - } - } - - return result; - } - - } - - public class XMLNamespace : XMLData - { - public string name; - public XMLClass [] types; - - public override void LoadData (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - - if (node.Name != "namespace") - throw new FormatException ("Expecting <namespace>"); - - name = node.Attributes ["name"].Value; - XmlNode classes = node.FirstChild; - if (classes == null) { - Console.Error.WriteLine ("Warning: no classes for {0}", node.Attributes ["name"]); - return; - } - - if (classes.Name != "classes") - throw new FormatException ("Expecting <classes>. Got <" + classes.Name + ">"); - - types = (XMLClass []) LoadRecursive (classes.ChildNodes, typeof (XMLClass)); - } - - static Hashtable CreateHash (XMLClass [] other) - { - Hashtable result = new Hashtable (); - if (other != null) { - int i = 0; - foreach (XMLClass c in other) { - result [c.Name] = i++; - } - } - - return result; - } - - public string Name { - get { return name; } - } - } - - public class XMLClass : XMLData - { - public string name; - public string type; - public string baseName; - bool isSealed; - bool isSerializable; - bool isAbstract; - string charSet; - string layout; - public XMLAttributes attributes; - public XMLInterfaces interfaces; - XMLGenericParameters genericParameters; - public XMLFields fields; - public XMLConstructors constructors; - public XMLProperties properties; - public XMLEvents events; - public XMLMethods methods; - public XMLClass [] nested; - - public override void LoadData (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - - name = node.Attributes ["name"].Value; - type = node.Attributes ["type"].Value; - XmlAttribute xatt = node.Attributes ["base"]; - if (xatt != null) - baseName = xatt.Value; - - xatt = node.Attributes ["sealed"]; - isSealed = (xatt != null && xatt.Value == "true"); - - xatt = node.Attributes ["abstract"]; - isAbstract = (xatt != null && xatt.Value == "true"); - - xatt = node.Attributes["serializable"]; - isSerializable = (xatt != null && xatt.Value == "true"); - - xatt = node.Attributes["charset"]; - if (xatt != null) - charSet = xatt.Value; - - xatt = node.Attributes["layout"]; - if (xatt != null) - layout = xatt.Value; - - XmlNode child = node.FirstChild; - if (child == null) { - // Console.Error.WriteLine ("Empty class {0} {1}", name, type); - return; - } - - if (child.Name == "attributes") { - attributes = new XMLAttributes (); - attributes.LoadData (child); - child = child.NextSibling; - } - - if (child != null && child.Name == "interfaces") { - interfaces = new XMLInterfaces (); - interfaces.LoadData (child); - child = child.NextSibling; - } - - if (child != null && child.Name == "generic-parameters") { - genericParameters = new XMLGenericParameters (); - genericParameters.LoadData (child); - child = child.NextSibling; - } - - if (child != null && child.Name == "fields") { - fields = new XMLFields (); - fields.LoadData (child); - child = child.NextSibling; - } - - if (child != null && child.Name == "constructors") { - constructors = new XMLConstructors (); - constructors.LoadData (child); - child = child.NextSibling; - } - - if (child != null && child.Name == "properties") { - properties = new XMLProperties (); - properties.LoadData (child); - child = child.NextSibling; - } - - if (child != null && child.Name == "events") { - events = new XMLEvents (); - events.LoadData (child); - child = child.NextSibling; - } - - if (child != null && child.Name == "methods") { - methods = new XMLMethods (); - methods.LoadData (child); - child = child.NextSibling; - } - - if (child == null) - return; - - if (child.Name != "classes") { - Console.WriteLine ("name: {0} type: {1} {2}", name, type, child.NodeType); - throw new FormatException ("Expecting <classes>. Got <" + child.Name + ">"); - } - - nested = (XMLClass []) LoadRecursive (child.ChildNodes, typeof (XMLClass)); - } - - static Hashtable CreateHash (XMLClass [] other) - { - Hashtable result = new Hashtable (); - if (other != null) { - int i = 0; - foreach (XMLClass c in other) { - result [c.Name] = i++; - } - } - - return result; - } - - public string Name { - get { return name; } - } - - public string Type { - get { return type; } - } - } - - public class XMLParameter : XMLData - { - public string name; - public string type; - public string attrib; - public string direction; - public bool isUnsafe; - public bool isOptional; - public string defaultValue; - public XMLAttributes attributes; - - public override void LoadData (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - - if (node.Name != "parameter") - throw new ArgumentException ("Expecting <parameter>"); - - name = node.Attributes["name"].Value; - type = node.Attributes["type"].Value; - attrib = node.Attributes["attrib"].Value; - if (node.Attributes ["direction"] != null) - direction = node.Attributes["direction"].Value; - if (node.Attributes["unsafe"] != null) - isUnsafe = bool.Parse (node.Attributes["unsafe"].Value); - if (node.Attributes["optional"] != null) - isOptional = bool.Parse (node.Attributes["optional"].Value); - if (node.Attributes["defaultValue"] != null) - defaultValue = node.Attributes["defaultValue"].Value; - - XmlNode child = node.FirstChild; - if (child == null) - return; - - if (child.Name == "attributes") { - attributes = new XMLAttributes (); - attributes.LoadData (child); - child = child.NextSibling; - } - } - - public string Name { - get { return name; } - } - } - - public class XMLAttributeProperties: XMLNameGroup - { - static Hashtable ignored_properties; - static XMLAttributeProperties () - { - ignored_properties = new Hashtable (); - ignored_properties.Add ("System.Reflection.AssemblyKeyFileAttribute", "KeyFile"); - ignored_properties.Add ("System.Reflection.AssemblyCompanyAttribute", "Company"); - ignored_properties.Add ("System.Reflection.AssemblyConfigurationAttribute", "Configuration"); - ignored_properties.Add ("System.Reflection.AssemblyCopyrightAttribute", "Copyright"); - ignored_properties.Add ("System.Reflection.AssemblyProductAttribute", "Product"); - ignored_properties.Add ("System.Reflection.AssemblyTrademarkAttribute", "Trademark"); - ignored_properties.Add ("System.Reflection.AssemblyInformationalVersionAttribute", "InformationalVersion"); - - ignored_properties.Add ("System.ObsoleteAttribute", "Message"); - ignored_properties.Add ("System.IO.IODescriptionAttribute", "Description"); - ignored_properties.Add ("System.Diagnostics.MonitoringDescriptionAttribute", "Description"); - } - - Hashtable properties = new Hashtable (); - string attribute; - - public XMLAttributeProperties (string attribute) - { - this.attribute = attribute; - } - - public override void LoadData(XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - - if (node.ChildNodes == null) - return; - - string ignored = ignored_properties [attribute] as string; - - foreach (XmlNode n in node.ChildNodes) { - string name = n.Attributes ["name"].Value; - if (ignored == name) - continue; - - if (n.Attributes ["null"] != null) { - properties.Add (name, null); - continue; - } - string value = n.Attributes ["value"].Value; - properties.Add (name, value); - } - } - - public override string GroupName { - get { - return "properties"; - } - } - - public override string Name { - get { - return ""; - } - } - } - - public class XMLAttributes : XMLNameGroup - { - Hashtable properties = new Hashtable (); - - bool isTodo; - string comment; - - protected override bool CheckIfAdd (string value, XmlNode node) - { - if (IsMonoTODOAttribute (value)) { - isTodo = true; - - XmlNode pNode = node.SelectSingleNode ("properties"); - if (pNode != null && pNode.ChildNodes.Count > 0 && pNode.ChildNodes [0].Attributes ["value"] != null) { - comment = pNode.ChildNodes [0].Attributes ["value"].Value; - } - return false; - } - - return true; - } - - public override string GetNodeKey (string name, XmlNode node) - { - string key = null; - - // if multiple attributes with the same name (type) exist, then we - // cannot be sure which attributes correspond, so we must use the - // name of the attribute (type) and the name/value of its properties - // as key - - XmlNodeList attributes = node.ParentNode.SelectNodes("attribute[@name='" + name + "']"); - if (attributes.Count > 1) { - ArrayList keyParts = new ArrayList (); - - XmlNodeList properties = node.SelectNodes ("properties/property"); - foreach (XmlNode property in properties) { - XmlAttributeCollection attrs = property.Attributes; - if (attrs["value"] != null) { - keyParts.Add (attrs["name"].Value + "=" + attrs["value"].Value); - } else { - keyParts.Add (attrs["name"].Value + "="); - } - } - - // sort properties by name, as order of properties in XML is - // undefined - keyParts.Sort (); - - // insert name (type) of attribute - keyParts.Insert (0, name); - - StringBuilder sb = new StringBuilder (); - foreach (string value in keyParts) { - sb.Append (value); - sb.Append (';'); - } - key = sb.ToString (); - } else { - key = name; - } - - return key; - } - - protected override void LoadExtraData(string name, XmlNode node) - { - XmlNode pNode = node.SelectSingleNode ("properties"); - - if (IsMonoTODOAttribute (name)) { - isTodo = true; - if (pNode.ChildNodes [0].Attributes ["value"] != null) { - comment = pNode.ChildNodes [0].Attributes ["value"].Value; - } - return; - } - - if (pNode != null) { - XMLAttributeProperties p = new XMLAttributeProperties (name); - p.LoadData (pNode); - - properties[name] = p; - } - } - - public override string GroupName { - get { return "attributes"; } - } - - public override string Name { - get { return "attribute"; } - } - - public bool IsTodo { - get { return isTodo; } - } - - public string Comment { - get { return comment; } - } - } - - public class XMLInterfaces : XMLNameGroup - { - public override string GroupName { - get { return "interfaces"; } - } - - public override string Name { - get { return "interface"; } - } - } - - public class XMLGenericParameters : XMLNameGroup - { - string attributes; - XMLGenericParameterConstraints constraints; - - public override string GroupName { - get { return "generic-parameters"; } - } - - public override string Name { - get { return "generic-parameters"; } - } - - protected override void LoadExtraData (string name, XmlNode node) - { - attributes = ((XmlElement) node).GetAttribute ("attributes"); - - var child = node.FirstChild; - if (child != null && child.Name == "generic-parameter-constraints") { - constraints = new XMLGenericParameterConstraints (); - constraints.LoadData (child); - } - } - } - - public class XMLGenericParameterConstraints : XMLNameGroup - { - public override string GroupName { - get { return "generic-parameter-constraints"; } - } - - public override string Name { - get { return "generic-parameter-constraint"; } - } - } - - public abstract class XMLMember : XMLNameGroup - { - public Hashtable attributeMap; - public Hashtable access = new Hashtable (); - - protected override void LoadExtraData (string name, XmlNode node) - { - XmlAttribute xatt = node.Attributes ["attrib"]; - if (xatt != null) - access [name] = xatt.Value; - - XmlNode orig = node; - - node = node.FirstChild; - while (node != null) { - if (node != null && node.Name == "attributes") { - XMLAttributes a = new XMLAttributes (); - a.LoadData (node); - if (attributeMap == null) - attributeMap = new Hashtable (); - - attributeMap [name] = a; - break; - } - node = node.NextSibling; - } - - base.LoadExtraData (name, orig); - } - - public virtual string ConvertToString (int att) - { - return null; - } - } - - public class XMLFields : XMLMember - { - public Hashtable fieldTypes; - public Hashtable fieldValues; - - protected override void LoadExtraData (string name, XmlNode node) - { - XmlAttribute xatt = node.Attributes ["fieldtype"]; - if (xatt != null) { - if (fieldTypes == null) - fieldTypes = new Hashtable (); - - fieldTypes [name] = xatt.Value; - } - - xatt = node.Attributes ["value"]; - if (xatt != null) { - if (fieldValues == null) - fieldValues = new Hashtable (); - - fieldValues[name] = xatt.Value; - } - - base.LoadExtraData (name, node); - } - - public override string ConvertToString (int att) - { - FieldAttributes fa = (FieldAttributes) att; - return fa.ToString (); - } - - public override string GroupName { - get { return "fields"; } - } - - public override string Name { - get { return "field"; } - } - } - - public class XMLParameters : XMLNameGroup - { - public override void LoadData (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - - if (node.Name != GroupName) - throw new FormatException (String.Format ("Expecting <{0}>", GroupName)); - - keys = new Hashtable (); - foreach (XmlNode n in node.ChildNodes) { - string name = n.Attributes["name"].Value; - string key = GetNodeKey (name, n); - XMLParameter parm = new XMLParameter (); - parm.LoadData (n); - keys.Add (key, parm); - LoadExtraData (key, n); - } - } - - public override string GroupName { - get { - return "parameters"; - } - } - - public override string Name { - get { - return "parameter"; - } - } - - public override string GetNodeKey (string name, XmlNode node) - { - return node.Attributes["position"].Value; - } - } - - public class XMLProperties : XMLMember - { - public Hashtable nameToMethod = new Hashtable (); - - protected override void LoadExtraData (string name, XmlNode node) - { - XmlNode orig = node; - node = node.FirstChild; - while (node != null) { - if (node != null && node.Name == "methods") { - XMLMethods m = new XMLMethods (); - XmlNode parent = node.ParentNode; - string key = GetNodeKey (name, parent); - m.LoadData (node); - nameToMethod [key] = m; - break; - } - node = node.NextSibling; - } - - - base.LoadExtraData (name, orig); - } - - public override string GetNodeKey (string name, XmlNode node) - { - XmlAttributeCollection atts = node.Attributes; - return String.Format ("{0}:{1}:{2}", atts ["name"].Value, - atts ["ptype"].Value, - atts ["params"].Value); - } - - public override string GroupName { - get { return "properties"; } - } - - public override string Name { - get { return "property"; } - } - } - - public class XMLEvents : XMLMember - { - public Hashtable eventTypes; - - protected override void LoadExtraData (string name, XmlNode node) - { - XmlAttribute xatt = node.Attributes ["eventtype"]; - if (xatt != null) { - if (eventTypes == null) - eventTypes = new Hashtable (); - - eventTypes [name] = xatt.Value; - } - - base.LoadExtraData (name, node); - } - - public override string ConvertToString (int att) - { - EventAttributes ea = (EventAttributes) att; - return ea.ToString (); - } - - public override string GroupName { - get { return "events"; } - } - - public override string Name { - get { return "event"; } - } - } - - public class XMLMethods : XMLMember - { - public Hashtable returnTypes; - public Hashtable parameters; - public Hashtable genericParameters; - public Hashtable signatureFlags; - - [Flags] - public enum SignatureFlags - { - None = 0, - Abstract = 1, - Virtual = 2, - Static = 4, - Final = 8, - } - - protected override void LoadExtraData (string name, XmlNode node) - { - XmlAttribute xatt = node.Attributes ["returntype"]; - if (xatt != null) { - if (returnTypes == null) - returnTypes = new Hashtable (); - - returnTypes [name] = xatt.Value; - } - - SignatureFlags flags = SignatureFlags.None; - if (((XmlElement) node).GetAttribute ("abstract") == "true") - flags |= SignatureFlags.Abstract; - if (((XmlElement) node).GetAttribute ("static") == "true") - flags |= SignatureFlags.Static; - if (((XmlElement) node).GetAttribute ("virtual") == "true") - flags |= SignatureFlags.Virtual; - if (((XmlElement) node).GetAttribute ("final") == "true") - flags |= SignatureFlags.Final; - if (flags != SignatureFlags.None) { - if (signatureFlags == null) - signatureFlags = new Hashtable (); - signatureFlags [name] = flags; - } - - XmlNode parametersNode = node.SelectSingleNode ("parameters"); - if (parametersNode != null) { - if (parameters == null) - parameters = new Hashtable (); - - XMLParameters parms = new XMLParameters (); - parms.LoadData (parametersNode); - - parameters[name] = parms; - } - - XmlNode genericNode = node.SelectSingleNode ("generic-parameters"); - if (genericNode != null) { - if (genericParameters == null) - genericParameters = new Hashtable (); - - XMLGenericParameters gparams = new XMLGenericParameters (); - gparams.LoadData (genericNode); - genericParameters [name] = gparams; - } - - base.LoadExtraData (name, node); - } - - public override string GetNodeKey (string name, XmlNode node) - { - // for explicit/implicit operators we need to include the return - // type in the key to allow matching; as a side-effect, differences - // in return types will be reported as extra/missing methods - // - // for regular methods we do not need to take into account the - // return type for matching methods; differences in return types - // will be reported as a warning on the method - if (name.StartsWith ("op_")) { - XmlAttribute xatt = node.Attributes ["returntype"]; - string returnType = xatt != null ? xatt.Value + " " : string.Empty; - return returnType + name; - } - return name; - } - - public override string ConvertToString (int att) - { - MethodAttributes ma = (MethodAttributes) att; - // ignore ReservedMasks - ma &= ~ MethodAttributes.ReservedMask; - ma &= ~ MethodAttributes.VtableLayoutMask; - if ((ma & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem) - ma = (ma & ~ MethodAttributes.FamORAssem) | MethodAttributes.Family; - - // ignore the HasSecurity attribute for now - if ((ma & MethodAttributes.HasSecurity) != 0) - ma = (MethodAttributes) (att - (int) MethodAttributes.HasSecurity); - - // ignore the RequireSecObject attribute for now - if ((ma & MethodAttributes.RequireSecObject) != 0) - ma = (MethodAttributes) (att - (int) MethodAttributes.RequireSecObject); - - // we don't care if the implementation is forwarded through PInvoke - if ((ma & MethodAttributes.PinvokeImpl) != 0) - ma = (MethodAttributes) (att - (int) MethodAttributes.PinvokeImpl); - - return ma.ToString (); - } - - public override string GroupName { - get { return "methods"; } - } - - public override string Name { - get { return "method"; } - } - } - - public class XMLConstructors : XMLMethods - { - public override string GroupName { - get { return "constructors"; } - } - - public override string Name { - get { return "constructor"; } - } - } - - public class XmlNodeComparer : IComparer - { - public static XmlNodeComparer Default = new XmlNodeComparer (); - - public int Compare (object a, object b) - { - XmlNode na = (XmlNode) a; - XmlNode nb = (XmlNode) b; - return String.Compare (na.Attributes ["name"].Value, nb.Attributes ["name"].Value); - } - } -} diff --git a/mcs/tools/corcompare/Metadata.cs b/mcs/tools/corcompare/Metadata.cs deleted file mode 100644 index de94a43c514..00000000000 --- a/mcs/tools/corcompare/Metadata.cs +++ /dev/null @@ -1,267 +0,0 @@ -// -// Metadata.cs -// -// (C) 2007 - 2008 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; - -namespace GuiCompare { - - public enum CompType { - Assembly, - Namespace, - Attribute, - Interface, - Class, - Struct, - Enum, - Method, - Property, - Field, - Delegate, - Event - } - - public interface ICompAttributeContainer - { - List<CompNamed> GetAttributes (); - } - - public interface ICompHasBaseType - { - string GetBaseType(); - } - - public interface ICompTypeContainer - { - List<CompNamed> GetNestedClasses(); - List<CompNamed> GetNestedInterfaces (); - List<CompNamed> GetNestedStructs (); - List<CompNamed> GetNestedEnums (); - List<CompNamed> GetNestedDelegates (); - } - - public interface ICompMemberContainer - { - List<CompNamed> GetInterfaces (); - List<CompNamed> GetConstructors(); - List<CompNamed> GetMethods(); - List<CompNamed> GetProperties(); - List<CompNamed> GetFields(); - List<CompNamed> GetEvents(); - } - - public abstract class CompNamed { - public CompNamed (string name, CompType type) - { - this.DisplayName = null; - this.name = name; - this.type = type; - this.todos = new List<string>(); - } - - public string Name { - set { name = value; } - get { return name; } - } - - public string DisplayName { - set { displayName = value; } - get { return displayName == null ? name : displayName; } - } - - public CompType Type { - set { type = value; } - get { return type; } - } - - public ComparisonNode GetComparisonNode () - { - ComparisonNode node = new ComparisonNode (type, DisplayName); - node.todos.AddRange (todos); - return node; - } - - public static int Compare (CompNamed x, CompNamed y) - { - return String.Compare (x.Name, y.Name); - } - - string displayName; - string name; - CompType type; - public List<string> todos; - } - - public abstract class CompAssembly : CompNamed, ICompAttributeContainer { - public CompAssembly (string name) - : base (name, CompType.Assembly) - { - } - - public abstract List<CompNamed> GetNamespaces (); - public abstract List<CompNamed> GetAttributes (); - } - - public abstract class CompNamespace : CompNamed, ICompTypeContainer { - public CompNamespace (string name) - : base (name, CompType.Namespace) - { - } - - // ICompTypeContainer implementation - public abstract List<CompNamed> GetNestedClasses(); - public abstract List<CompNamed> GetNestedInterfaces (); - public abstract List<CompNamed> GetNestedStructs (); - public abstract List<CompNamed> GetNestedEnums (); - public abstract List<CompNamed> GetNestedDelegates (); - } - - public abstract class CompInterface : CompNamed, ICompAttributeContainer, ICompMemberContainer, ICompHasBaseType { - public CompInterface (string name) - : base (name, CompType.Interface) - { - } - - public abstract List<CompNamed> GetAttributes (); - - public abstract List<CompNamed> GetInterfaces (); - public abstract List<CompNamed> GetConstructors(); - public abstract List<CompNamed> GetMethods(); - public abstract List<CompNamed> GetProperties(); - public abstract List<CompNamed> GetFields(); - public abstract List<CompNamed> GetEvents(); - - public abstract string GetBaseType(); - } - - public abstract class CompEnum : CompNamed, ICompAttributeContainer, ICompMemberContainer, ICompHasBaseType { - public CompEnum (string name) - : base (name, CompType.Enum) - { - } - - public List<CompNamed> GetInterfaces () { return new List<CompNamed>(); } - public List<CompNamed> GetConstructors() { return new List<CompNamed>(); } - public List<CompNamed> GetMethods() { return new List<CompNamed>(); } - public List<CompNamed> GetProperties() { return new List<CompNamed>(); } - public List<CompNamed> GetEvents() { return new List<CompNamed>(); } - - public abstract List<CompNamed> GetFields(); - - public abstract List<CompNamed> GetAttributes (); - - public abstract string GetBaseType(); - } - - public abstract class CompDelegate : CompNamed, ICompHasBaseType { - public CompDelegate (string name) - : base (name, CompType.Delegate) - { - } - - public abstract string GetBaseType(); - } - - public abstract class CompClass : CompNamed, ICompAttributeContainer, ICompTypeContainer, ICompMemberContainer, ICompHasBaseType { - public CompClass (string name, CompType type) - : base (name, type) - { - } - - public abstract List<CompNamed> GetInterfaces(); - public abstract List<CompNamed> GetConstructors(); - public abstract List<CompNamed> GetMethods(); - public abstract List<CompNamed> GetProperties(); - public abstract List<CompNamed> GetFields(); - public abstract List<CompNamed> GetEvents(); - - public abstract List<CompNamed> GetAttributes (); - - public abstract List<CompNamed> GetNestedClasses(); - public abstract List<CompNamed> GetNestedInterfaces (); - public abstract List<CompNamed> GetNestedStructs (); - public abstract List<CompNamed> GetNestedEnums (); - public abstract List<CompNamed> GetNestedDelegates (); - - public abstract string GetBaseType(); - } - - public abstract class CompMember : CompNamed, ICompAttributeContainer { - public CompMember (string name, CompType type) - : base (name, type) - { - } - - public abstract string GetMemberAccess(); - public abstract string GetMemberType(); - - public abstract List<CompNamed> GetAttributes (); - } - - public abstract class CompMethod : CompMember { - public CompMethod (string name) - : base (name, CompType.Method) - { - } - - public abstract bool ThrowsNotImplementedException (); - } - - public abstract class CompProperty : CompMember, ICompMemberContainer { - public CompProperty (string name) - : base (name, CompType.Property) - { - } - - public abstract List<CompNamed> GetMethods(); - public List<CompNamed> GetInterfaces() { return new List<CompNamed>(); } - public List<CompNamed> GetConstructors() { return new List<CompNamed>(); } - public List<CompNamed> GetEvents() { return new List<CompNamed>(); } - public List<CompNamed> GetFields() { return new List<CompNamed>(); } - public List<CompNamed> GetProperties() { return new List<CompNamed>(); } - } - - public abstract class CompField : CompMember { - public CompField (string name) - : base (name, CompType.Field) - { - } - public abstract string GetLiteralValue (); - } - - public abstract class CompEvent : CompMember { - public CompEvent (string name) - : base (name, CompType.Event) - { - } - } - - public abstract class CompAttribute : CompNamed { - public CompAttribute (string typename) - : base (typename, CompType.Attribute) - { - } - } -} |