hack-codegen
hack-codegen copied to clipboard
Support renderers for args in addMultilineCall
For our current use of addMultilineCall, it's fairly common to pass literals as arguments, including nested arrays. Would be nice if we could use HackBuilderValues::export() rather than having to do it manually.
I'm not sure how to design this in a way that works reasonably well for both all-args-have-same-renderer and different-renderer-per-arg.
It might be best to add a HackBuilderValue type which includes both a T and a IHackBuilderValueRenderer<T>, and take multiple hackbuildervalues
This is probably worth looking at v5, which hopefully won't be as long away as v3 => v4 :)
Waking this issue from its multi year slumber. My instinct says: Why not both?
Keep the current addMultilineCall() around, since requiring a builder for a true literal would be cumbersome. Add a new method which takes on builder and apply it to all arguments.
I am not sure a third version taking builder+value pairs would be much more convenient than using the builders at the call site. There is no need to add this in the same PR, so that may/might be postponed (indefinitely?).