Skip to content

Commit

Permalink
TypeImplementer: Implement multiple interfaces
Browse files Browse the repository at this point in the history
Issue mono#34 reports that only the main interface is presented, so that if
e.g. a programmer wishes to add the properties interface to a type, then
the resulting implementation attempts to call the method on the
incorrect interface.

This is due to a premature optimisation, which this patch removes.
  • Loading branch information
arfbtwn committed Nov 16, 2014
1 parent 186115a commit c4e78ee
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/TypeImplementer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ public Type GetImplementation (Type declType)

TypeBuilder typeB = modB.DefineType (proxyName, TypeAttributes.Class | TypeAttributes.Public, parentType);

string interfaceName = null;
if (declType.IsInterface)
Implement (typeB, declType, interfaceName = Mapper.GetInterfaceName (declType));
Implement (typeB, declType, Mapper.GetInterfaceName (declType));

foreach (Type iface in declType.GetInterfaces ())
Implement (typeB, iface, interfaceName == null ? Mapper.GetInterfaceName (iface) : interfaceName);
Implement (typeB, iface, Mapper.GetInterfaceName (iface));

retT = typeB.CreateType ();

Expand Down

0 comments on commit c4e78ee

Please sign in to comment.