Nitrox icon indicating copy to clipboard operation
Nitrox copied to clipboard

Unify Transpilers code

Open dartasen opened this issue 1 year ago • 1 comments

Describe the issue

There's currently 3 different methods of writing Transpiler, which can be a nightmare for newcomers & readability :

  • Old way (by hand with a foreach loop and a TARGET_METHOD, TARGET_OPERAND)
  • CodeMatcher
  • Our custom InstructionsPattern API

We should unify the API we're using to patch, and also unify (and add documentation) to the comments that describes the patch, ie:

if (isActive)
{
     A();
     NitroxB();           [INSERTED LINE]
}

dartasen avatar Jan 05 '25 17:01 dartasen

The foreach way I agree should go, but other 2 I don't mind. CodeMatcher (cursor-like) uses different strategy than InstructionsPattern (pattern based) and both have their pros and cons.

Measurity avatar Jan 05 '25 18:01 Measurity