Handling multiple assignments to function call
When it comes to multiple assignments including one that contains a function call, Go2Pins fail to handle it well. Exemple:
package main
func foo() int {
return 42
}
func main() {
a, b := foo(), 2
a, b = 2, foo()
a, b = foo(), foo()
}
All of the cases in main
function does not work. It will ignore everything except the function call.
Thus, an easy way to handle it would be to make one assignment for each function call:
package main
func foo() int {
return 42
}
func main() {
a := foo()
b := 2
a = 2
b = foo()
a = foo()
b = foo()
}
We can take a closer look on transform/cfg/transform.go
and transform/cfg/linkresults.go
for a proper way to handle it,