Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use generated generic
Linker.DefineFunction()
and `Function.FromCal…
…lback()` overloads for efficiently invoking callbacks (#163) * Use a T4 text template to generate overloads of generic Linker.DefineFunction() methods that can efficiently call the specified callback without reflection. * Simplify. * Follow-Up: Also implement the generic overload generation for Function.FromCallback(). * Follow-Up: Returning a ValueTuple<> with more than 4 type arguments requires to use the overload taking a Delegate. * Add more tests. * Follow-Up: Fall back to using reflection instead of throwing an exception when the parameter/result type combination cannot be represented with the current generic parameters. * Add more tests including one for a custom callback delegate. * Directly specify the delegate parameter and return types, so that it's not necessary to use reflection to find the delegate's Invoke() method. * Update for changes in #172. * PR feedback: Extract duplicated code into a separate .t4 file that can be included in the .tt files. * PR feedback: Use a bool value for hasCaller. * PR feedback: Use a local tool manifest file for the dotnet-t4 tool, and invoke it automatically when building the project. * Follow-Up: Run "dotnet tool restore" to automatically make the tool available. * We no longer need to specify the -o flag since mono/t4#142 has been fixed in version 2.3.1.
- Loading branch information