Skip to content

Commit

Permalink
Type bootstrap method arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Jul 31, 2024
1 parent 91ce971 commit 64a56da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace IKVM.ByteCode.Parsing
{

public record struct BootstrapMethodsAttributeMethodRecord(MethodrefConstantHandle Methodref, ushort[] Arguments)
public record struct BootstrapMethodsAttributeMethodRecord(MethodrefConstantHandle Methodref, ConstantHandle[] Arguments)
{

public static bool TryReadBootstrapMethod(ref ClassFormatReader reader, out BootstrapMethodsAttributeMethodRecord method)
Expand All @@ -13,16 +13,16 @@ public static bool TryReadBootstrapMethod(ref ClassFormatReader reader, out Boot
if (reader.TryReadU2(out ushort argumentCount) == false)
return false;

var arguments = new ushort[argumentCount];
var arguments = new ConstantHandle[argumentCount];
for (int i = 0; i < argumentCount; i++)
{
if (reader.TryReadU2(out ushort argumentIndex) == false)
return false;

arguments[i] = argumentIndex;
arguments[i] = new(argumentIndex);
}

method = new BootstrapMethodsAttributeMethodRecord(new (methodrefIndex), arguments);
method = new BootstrapMethodsAttributeMethodRecord(new(methodrefIndex), arguments);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal BootstrapMethodsAttributeMethodReader(ClassReader declaringClass, Boots
/// <summary>
/// Gets the arguments bound to the method reference.
/// </summary>
public IReadOnlyList<IConstantReader> Arguments => LazyGet(ref arguments, () => new DelegateLazyReaderList<IConstantReader, ushort>(DeclaringClass, Record.Arguments, (_, index) => DeclaringClass.Constants[index]));
public IReadOnlyList<IConstantReader> Arguments => LazyGet(ref arguments, () => new DelegateLazyReaderList<IConstantReader, ConstantHandle>(DeclaringClass, Record.Arguments, (_, handle) => DeclaringClass.Constants[handle]));

}

Expand Down

0 comments on commit 64a56da

Please sign in to comment.