Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void AddNestedTypes (TypeDefinition type)
}
}

foreach (MethodDefinition imethod in type.Interfaces.Cast<TypeReference> ()
foreach (MethodDefinition imethod in type.Interfaces.Select (ifaceInfo => ifaceInfo.InterfaceType)
.Select (r => {
var d = r.Resolve ();
if (d == null)
Expand All @@ -141,7 +141,7 @@ void AddNestedTypes (TypeDefinition type)
return d;
})
.Where (d => GetRegisterAttributes (d).Any ())
.SelectMany (d => d.Methods.Cast<MethodDefinition>())) {
.SelectMany (d => d.Methods)) {
AddMethod (imethod, imethod);
}

Expand Down Expand Up @@ -538,7 +538,7 @@ void GenerateHeader (TextWriter sw)
sw.WriteLine ("\textends " + extendsType);
sw.WriteLine ("\timplements");
sw.Write ("\t\tmono.android.IGCUserPeer");
IEnumerable<TypeDefinition> ifaces = type.Interfaces.Cast<TypeReference>()
IEnumerable<TypeDefinition> ifaces = type.Interfaces.Select (ifaceInfo => ifaceInfo.InterfaceType)
.Select (r => r.Resolve ())
.Where (d => GetRegisterAttributes (d).Any ());
if (ifaces.Any ()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,14 +612,14 @@ internal static bool IsNonStaticInnerClass (TypeDefinition type)
return false;

return GetBaseConstructors (type)
.Any (ctor => ctor.Parameters.Cast<ParameterDefinition> ().Any (p => p.Name == "__self"));
.Any (ctor => ctor.Parameters.Any (p => p.Name == "__self"));
}

static IEnumerable<MethodDefinition> GetBaseConstructors (TypeDefinition type)
{
var baseType = type.GetBaseTypes ().FirstOrDefault (t => t.GetCustomAttributes (typeof (RegisterAttribute)).Any ());
if (baseType != null)
return baseType.Methods.Where (m => m.IsConstructor && !m.IsStatic).Cast<MethodDefinition> ();
return baseType.Methods.Where (m => m.IsConstructor && !m.IsStatic);
return Enumerable.Empty<MethodDefinition> ();
}
#endif // HAVE_CECIL
Expand Down