2018-10-30 18:43:02 -07:00
|
|
|
using System.Reflection.Emit;
|
|
|
|
|
|
|
|
namespace ChocolArm64.Translation
|
|
|
|
{
|
|
|
|
class ILLabel : IILEmit
|
|
|
|
{
|
|
|
|
private bool _hasLabel;
|
|
|
|
|
2019-02-27 18:03:31 -08:00
|
|
|
private Label _label;
|
2018-10-30 18:43:02 -07:00
|
|
|
|
2018-12-10 16:58:52 -08:00
|
|
|
public void Emit(ILMethodBuilder context)
|
2018-10-30 18:43:02 -07:00
|
|
|
{
|
|
|
|
context.Generator.MarkLabel(GetLabel(context));
|
|
|
|
}
|
|
|
|
|
2018-12-10 16:58:52 -08:00
|
|
|
public Label GetLabel(ILMethodBuilder context)
|
2018-10-30 18:43:02 -07:00
|
|
|
{
|
|
|
|
if (!_hasLabel)
|
|
|
|
{
|
2019-02-27 18:03:31 -08:00
|
|
|
_label = context.Generator.DefineLabel();
|
2018-10-30 18:43:02 -07:00
|
|
|
|
|
|
|
_hasLabel = true;
|
|
|
|
}
|
|
|
|
|
2019-02-27 18:03:31 -08:00
|
|
|
return _label;
|
2018-10-30 18:43:02 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|