Cecil.TypeDefinition resolve_cecil_type_ref(Cecil.TypeReference type)
{
type = type.GetOriginalType ();
if (type is Cecil.TypeDefinition)
return (Cecil.TypeDefinition) type;
Cecil.AssemblyNameReference reference = type.Scope as Cecil.AssemblyNameReference;
if (reference != null) {
Cecil.AssemblyDefinition assembly = resolve_cecil_asm_name (reference);
if (assembly == null)
return null;
return assembly.MainModule.Types [type.FullName];
}
Cecil.ModuleDefinition module = type.Scope as Cecil.ModuleDefinition;
if (module != null)
return module.Types [type.FullName];
throw new NotImplementedException ();
}