return mb.DeclaringType.FullName.Replace ('+', '.') + '.' + name;
}
- static public string GetFullName (Type t)
+ private static void GetFullName_recursed (StringBuilder sb, Type t, bool recursed)
{
- if (t.FullName == null)
- return t.Name;
-
- string name = t.FullName.Replace ('+', '.');
+ if (t.IsGenericParameter) {
+ sb.Append (t.Name);
+ return;
+ }
- DeclSpace tc = LookupDeclSpace (t);
- if ((tc != null) && tc.IsGeneric) {
- TypeParameter[] tparam = tc.TypeParameters;
+ if (t.DeclaringType != null) {
+ GetFullName_recursed (sb, t.DeclaringType, true);
+ sb.Append (".");
+ }
- StringBuilder sb = new StringBuilder (name);
- sb.Append ("<");
- for (int i = 0; i < tparam.Length; i++) {
- if (i > 0)
- sb.Append (",");
- sb.Append (tparam [i].Name);
+ if (!recursed) {
+ string ns = t.Namespace;
+ if ((ns != null) && (ns != "")) {
+ sb.Append (ns);
+ sb.Append (".");
}
- sb.Append (">");
- return sb.ToString ();
- } else if (t.HasGenericArguments && !t.IsGenericInstance) {
- Type[] tparam = t.GetGenericArguments ();
+ }
+
+ sb.Append (SimpleName.RemoveGenericArity (t.Name));
- StringBuilder sb = new StringBuilder (name);
+ Type[] args = GetTypeArguments (t);
+ if (args.Length > 0) {
sb.Append ("<");
- for (int i = 0; i < tparam.Length; i++) {
+ for (int i = 0; i < args.Length; i++) {
if (i > 0)
sb.Append (",");
- sb.Append (tparam [i].Name);
+ sb.Append (GetFullName (args [i]));
}
sb.Append (">");
- return sb.ToString ();
}
+ }
- return name;
+ static public string GetFullName (Type t)
+ {
+ StringBuilder sb = new StringBuilder ();
+ GetFullName_recursed (sb, t, false);
+ return sb.ToString ();
}
/// <summary>
if (texpr == null)
return null;
- if (!new_ifaces.Contains (texpr.Type))
- new_ifaces.Add (texpr.Type);
+ if (new_ifaces.Contains (texpr.Type))
+ continue;
+
+ new_ifaces.Add (texpr.Type);
Type [] implementing = texpr.Type.GetInterfaces ();
-
+
foreach (Type imp in implementing){
if (!new_ifaces.Contains (imp))
new_ifaces.Add (imp);
/// </summary>
public static Type [] GetInterfaces (Type t)
{
-
Type [] cached = iface_cache [t] as Type [];
if (cached != null)
return cached;
if (t.IsArray)
t = TypeManager.array_type;
- if (t is TypeBuilder){
+ if ((t is TypeBuilder) || t.IsGenericInstance) {
Type [] base_ifaces;
if (t.BaseType == null)
base_ifaces = NoTypes;
else
base_ifaces = GetInterfaces (t.BaseType);
- Type[] type_ifaces = (Type []) builder_to_ifaces [t];
+ Type[] type_ifaces;
+ if (t.IsGenericInstance)
+ type_ifaces = t.GetInterfaces ();
+ else
+ type_ifaces = (Type []) builder_to_ifaces [t];
if (type_ifaces == null)
type_ifaces = NoTypes;
new Type [] { typeof (Type), typeof (bool)},
null);
if (declare_local_method == null){
- Report.Warning (-24, new Location (-1),
+ Report.Warning (-30, new Location (-1),
"This version of the runtime does not support making pinned local variables. " +
"This code may cause errors on a runtime with a moving GC");
return ig.DeclareLocal (t);
internal Assembly invocation_assembly;
internal IList almost_match;
- private bool CheckValidFamilyAccess (bool is_static, MemberInfo m)
- {
- if (invocation_type == null)
- return false;
-
- Debug.Assert (IsNestedFamilyAccessible (invocation_type, m.DeclaringType));
-
- if (is_static)
- return true;
-
- // A nested class has access to all the protected members visible
- // to its parent.
- if (qualifier_type != null
- && TypeManager.IsNestedChildOf (invocation_type, qualifier_type))
- return true;
-
- if (invocation_type == m.DeclaringType
- || invocation_type.IsSubclassOf (m.DeclaringType)) {
- // Although a derived class can access protected members of
- // its base class it cannot do so through an instance of the
- // base class (CS1540).
- // => Ancestry should be: declaring_type ->* invocation_type
- // ->* qualified_type
- if (qualifier_type == null
- || qualifier_type == invocation_type
- || qualifier_type.IsSubclassOf (invocation_type))
- return true;
- }
-
- if (almost_match != null)
- almost_match.Add (m);
- return false;
- }
-
bool Filter (MethodBase mb, object filter_criteria)
{
MethodAttributes ma = mb.Attributes & MethodAttributes.MemberAccessMask;