Skip to content

Commit

Permalink
ImplementedInterfaces should store a reference to their DeclaringType.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpobst committed Jul 6, 2023
1 parent 7962980 commit f5c76be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Javil/Adapters/BytecodeReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ private static TypeDefinition CreateType (string @namespace, string name, TypeRe
// Implemented interfaces
for (var i = 0; i < classFile.Interfaces.Count; i++) {
if (signature?.SuperinterfaceSignatures.Any () == true)
td.ImplementedInterfaces.Add (new ImplementedInterface (TypeReference.CreateFromSignature (signature.SuperinterfaceSignatures[i], container)));
td.ImplementedInterfaces.Add (new ImplementedInterface (td, TypeReference.CreateFromSignature (signature.SuperinterfaceSignatures[i], container)));
else
td.ImplementedInterfaces.Add (new ImplementedInterface (TypeReference.CreateFromFullName (classFile.Interfaces[i].Name.Value, container)));
td.ImplementedInterfaces.Add (new ImplementedInterface (td, TypeReference.CreateFromFullName (classFile.Interfaces[i].Name.Value, container)));
}

// Fields
Expand Down
9 changes: 7 additions & 2 deletions src/Javil/ImplementedInterface.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
namespace Javil;
using System.Runtime.CompilerServices;
using Javil.Extensions;

namespace Javil;

public class ImplementedInterface
{
public TypeReference InterfaceType { get; }
public TypeDefinition DeclaringType { get; }

public ImplementedInterface (TypeReference interfaceType)
public ImplementedInterface (TypeDefinition declaringType, TypeReference interfaceType)
{
DeclaringType = declaringType;
InterfaceType = interfaceType;
}
}

0 comments on commit f5c76be

Please sign in to comment.