LocalVariableAssignments transform: handling global variables decl before accessing it
Currently LocalVariablesAssignments
transform does not work well when a global variables is declared after accessing it.
Exemple:
package main
func main() {
a = 42
}
var a int
Since meta
hasn't stored it yet in the our vector, no transform will be applied on the assignment
in the main
function.
Resulting to something like this:
package main
func G2P_main(G2PState structs.G2PStateType) {
G2PState[5] = 0 // global variable a
a = 42
}
Thus, it seems that the "simplest thing" to do is to make a transform before that will handle it.