This disclosure describes code conversion techniques for replacement of function calls that utilize pass by reference in program code in a source language with equivalent constructs in a target language that does not support pass by reference. When a pass by reference is encountered in the source program code, a wrapper object is created by wrapping a native object with a pre-defined key. In the translated code, the value of the object for the specified key is updated instead of being accessed as a normal variable. Upon return of program control from the called function, the value assigned to the object for the key is assigned back to the original variable. The variable now stores an updated value, just as it would in a pass by reference scenario.
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.
BA, Paneendra; Garg, Abhay; Ginet, Alexandre; and De, Arijit, "Pass By Reference Substitution During Code Migration", Technical Disclosure Commons, (November 17, 2020)