Nitrox
Nitrox copied to clipboard
Unify Transpilers code
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]
}
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.