const rinf … const winf … // calleefx returns a list of parameter indices indicating the order // in which parameters are first referenced during evaluation of the // callee, relative both to each other and to other effects of the // callee (if any), such as arbitrary reads (rinf) and arbitrary // effects (winf), including unknown control flow. Each parameter // that is referenced appears once in the list. // // For example, the effects list of this function: // // func f(x, y, z int) int { // return y + x + g() + z // } // // is [1 0 -2 2], indicating reads of y and x, followed by the unknown // effects of the g() call. and finally the read of parameter z. This // information is used during inlining to ascertain when it is safe // for parameter references to be replaced by their corresponding // argument expressions. Such substitutions are permitted only when // they do not cause "write" operations (those with effects) to // commute with "read" operations (those that have no effect but are // not pure). Impure operations may be reordered with other impure // operations, and pure operations may be reordered arbitrarily. // // The analysis ignores the effects of runtime panics, on the // assumption that well-behaved programs shouldn't encounter them. func calleefx(info *types.Info, body *ast.BlockStmt, paramInfos map[*types.Var]*paramInfo) []int { … }