Browse Source

Fixed reading Nested Types.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6027 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Tomáš Linhart 15 years ago
parent
commit
8c4aef994d
  1. 5
      src/AddIns/Analysis/CodeQuality/Src/Field.cs
  2. 5
      src/AddIns/Analysis/CodeQuality/Src/Method.cs
  3. 31
      src/AddIns/Analysis/CodeQuality/Src/MetricsReader.cs
  4. 5
      src/AddIns/Analysis/CodeQuality/Src/Module.cs
  5. 5
      src/AddIns/Analysis/CodeQuality/Src/Namespace.cs
  6. 13
      src/AddIns/Analysis/CodeQuality/Src/Type.cs

5
src/AddIns/Analysis/CodeQuality/Src/Field.cs

@ -22,5 +22,10 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -22,5 +22,10 @@ namespace ICSharpCode.CodeQualityAnalysis
{
return null;
}
public override string ToString()
{
return Name;
}
}
}

5
src/AddIns/Analysis/CodeQuality/Src/Method.cs

@ -44,5 +44,10 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -44,5 +44,10 @@ namespace ICSharpCode.CodeQualityAnalysis
{
return null;
}
public override string ToString()
{
return Name;
}
}
}

31
src/AddIns/Analysis/CodeQuality/Src/MetricsReader.cs

@ -41,7 +41,8 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -41,7 +41,8 @@ namespace ICSharpCode.CodeQualityAnalysis
Name = moduleDefinition.Name
};
ReadTypes(MainModule, moduleDefinition.Types);
if (moduleDefinition.HasTypes)
ReadTypes(MainModule, moduleDefinition.Types);
}
/// <summary>
@ -53,13 +54,19 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -53,13 +54,19 @@ namespace ICSharpCode.CodeQualityAnalysis
{
// first add all types, because i will need find depend types
AddTypes(module, types);
ReadFromTypes(module, types);
}
private void AddTypes(Module module, Collection<TypeDefinition> types)
{
foreach (TypeDefinition typeDefinition in types)
{
if (typeDefinition.Name != "<Module>")
{
var type = new Type()
{
FullName = FormatTypeName(typeDefinition),
Name = FormatTypeName(typeDefinition)
};
@ -73,19 +80,25 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -73,19 +80,25 @@ namespace ICSharpCode.CodeQualityAnalysis
if (ns == null)
{
ns = new Namespace()
{
Name = nsName,
Module = module
};
{
Name = nsName,
Module = module
};
module.Namespaces.Add(ns);
}
type.Namespace = ns;
ns.Types.Add(type);
if (typeDefinition.HasNestedTypes)
AddTypes(module, typeDefinition.NestedTypes);
}
}
}
private void ReadFromTypes(Module module, Collection<TypeDefinition> types)
{
foreach (TypeDefinition typeDefinition in types)
{
if (typeDefinition.Name != "<Module>")
@ -94,7 +107,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -94,7 +107,7 @@ namespace ICSharpCode.CodeQualityAnalysis
(from n in module.Namespaces
from t in n.Types
where (t.Name == FormatTypeName(typeDefinition))
select t).SingleOrDefault();
select t).SingleOrDefault();
if (typeDefinition.HasFields)
@ -108,9 +121,11 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -108,9 +121,11 @@ namespace ICSharpCode.CodeQualityAnalysis
/*if (typeDefinition.HasConstructors)
ReadConstructors(type, typeDefinition.Constructors);*/
if (typeDefinition.HasNestedTypes)
ReadFromTypes(module, typeDefinition.NestedTypes);
}
}
}
private void ReadEvents(Type type, Collection<EventDefinition> events)

5
src/AddIns/Analysis/CodeQuality/Src/Module.cs

@ -27,5 +27,10 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -27,5 +27,10 @@ namespace ICSharpCode.CodeQualityAnalysis
{
return null;
}
public override string ToString()
{
return Name;
}
}
}

5
src/AddIns/Analysis/CodeQuality/Src/Namespace.cs

@ -50,5 +50,10 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -50,5 +50,10 @@ namespace ICSharpCode.CodeQualityAnalysis
return g;
}
public override string ToString()
{
return Name;
}
}
}

13
src/AddIns/Analysis/CodeQuality/Src/Type.cs

@ -26,7 +26,13 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -26,7 +26,13 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// Name of type with a name of namespace.
/// </summary>
public string FullName { get; set; }
public string FullName
{
get
{
return Namespace.Name + "." + Name;
}
}
/// <summary>
/// Name of type
@ -95,5 +101,10 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -95,5 +101,10 @@ namespace ICSharpCode.CodeQualityAnalysis
return g;
}
public override string ToString()
{
return FullName;
}
}
}

Loading…
Cancel
Save