Skip to content

Commit

Permalink
Encode existing.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Aug 1, 2024
1 parent f0780d8 commit ad38696
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/IKVM.ByteCode/Writing/TypeAnnotationTableEncoder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Security.Policy;

using IKVM.ByteCode.Buffers;
using IKVM.ByteCode.Parsing;
Expand Down Expand Up @@ -29,28 +28,23 @@ public TypeAnnotationTableEncoder(BlobBuilder builder)
}

/// <summary>
/// Adds an annotation.
/// Encodes an existing annotation.
/// </summary>
/// <param name="annotation"></param>
public TypeAnnotationTableEncoder Add(Action<TypeAnnotationEncoder> annotation)
/// <param name="record"></param>
public void Encode(TypeAnnotationRecord record)
{
annotation(new TypeAnnotationEncoder(_builder));
new ClassFormatWriter(_countBlob.GetBytes()).TryWriteU2(++_count);
return this;
Annotation(e => e.Encode(record));
}

/// <summary>
/// Adds an annotation.
/// </summary>
/// <param name="record"></param>
/// <returns></returns>
public TypeAnnotationTableEncoder Add(TypeAnnotationRecord record)
{
return Add(encoder => Add(encoder, record));
}

static void Add(TypeAnnotationEncoder encoder, TypeAnnotationRecord record)
/// <param name="annotation"></param>
public TypeAnnotationTableEncoder Annotation(Action<TypeAnnotationEncoder> annotation)
{
annotation(new TypeAnnotationEncoder(_builder));
new ClassFormatWriter(_countBlob.GetBytes()).TryWriteU2(++_count);
return this;
}

}
Expand Down

0 comments on commit ad38696

Please sign in to comment.