//
// Dual licensed under the terms of the MIT X11 or GNU GPL
//
-// Copyright 2009, 2010 Novell, Inc
+// Copyright 2009-2011 Novell, Inc
+// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
//
using System;
break;
default:
// Ignore private fields (even for error reporting) to not require extra dependencies
- if (IgnorePrivateMembers || HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace))
+ if ((IgnorePrivateMembers && !declaringType.IsStruct) ||
+ HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace))
return null;
mod = Modifiers.PRIVATE;
if (spec.BaseType != null) {
var bifaces = spec.BaseType.Interfaces;
if (bifaces != null) {
+ //
+ // Before adding base class interfaces close defined interfaces
+ // on type parameter
+ //
+ var tp = spec as TypeParameterSpec;
+ if (tp != null && tp.InterfacesDefined == null) {
+ tp.InterfacesDefined = TypeSpec.EmptyTypes;
+ }
+
foreach (var iface in bifaces)
spec.AddInterface (iface);
}
if ((t.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate && importer.IgnorePrivateMembers)
continue;
- imported = importer.CreateNestedType (t, declaringType);
+ try {
+ imported = importer.CreateNestedType (t, declaringType);
+ } catch (Exception e) {
+ throw new InternalErrorException (e, "Could not import nested type `{0}' from `{1}'",
+ t.FullName, declaringType.MemberDefinition.DeclaringAssembly.FullName);
+ }
+
cache.AddMemberImported (imported);
}
}
}
+ //
+ // Load base interfaces first to minic behaviour of compiled members
+ //
+ if (declaringType.IsInterface && declaringType.Interfaces != null) {
+ foreach (var iface in declaringType.Interfaces) {
+ cache.AddInterface (iface);
+ }
+ }
+
if (!onlyTypes) {
//
// The logic here requires methods to be returned first which seems to work for both Mono and .NET
cache.AddMemberImported (imported);
}
}
-
- if (declaringType.IsInterface && declaringType.Interfaces != null) {
- foreach (var iface in declaringType.Interfaces) {
- cache.AddInterface (iface);
- }
- }
}
}