Browse Source

Extract type map setup in another method to make the code clearer.

pull/1/head
triton 13 years ago
parent
commit
0f2e802925
  1. 22
      src/Generator/Types/TypeMap.cs

22
src/Generator/Types/TypeMap.cs

@ -80,17 +80,21 @@ namespace Cxxi.Types
foreach (var assembly in loadedAssemblies) foreach (var assembly in loadedAssemblies)
{ {
var types = assembly.FindDerivedTypes(typeof(TypeMap)); var types = assembly.FindDerivedTypes(typeof(TypeMap));
SetupTypeMaps(types);
}
}
private void SetupTypeMaps(IEnumerable<System.Type> types)
{
foreach (var typeMap in types)
{
var attrs = typeMap.GetCustomAttributes<TypeMapAttribute>();
if (attrs == null) continue;
foreach (var typeMap in types) foreach (var attr in attrs)
{ {
var attrs = typeMap.GetCustomAttributes<TypeMapAttribute>(); Console.WriteLine("Found typemap: {0}", attr.Type);
if (attrs == null) continue; TypeMaps[attr.Type] = typeMap;
foreach (var attr in attrs)
{
Console.WriteLine("Found typemap: {0}", attr.Type);
TypeMaps[attr.Type] = typeMap;
}
} }
} }
} }

Loading…
Cancel
Save