ILLabel.cs 555 B

12345678910111213141516171819202122232425262728
  1. using System.Reflection.Emit;
  2. namespace ChocolArm64.Translation
  3. {
  4. class ILLabel : IILEmit
  5. {
  6. private bool _hasLabel;
  7. private Label _label;
  8. public void Emit(ILMethodBuilder context)
  9. {
  10. context.Generator.MarkLabel(GetLabel(context));
  11. }
  12. public Label GetLabel(ILMethodBuilder context)
  13. {
  14. if (!_hasLabel)
  15. {
  16. _label = context.Generator.DefineLabel();
  17. _hasLabel = true;
  18. }
  19. return _label;
  20. }
  21. }
  22. }