1
0
mirror of https://github.com/golang/go synced 2024-11-22 20:04:47 -07:00

cmd/compile/internal/walk: relocate a stray comment

The explanatory comment and the associated version counter variable
for the helper routine "wrapCall" seem to have been left behind in
walk.go during the big refactoring -- move it back to where it should
be, next to wrapCall in stmt.go. Also fix a small buglet in the
comment itself.

Change-Id: I8637a838214b216581be59e01149a72282a46526
Reviewed-on: https://go-review.googlesource.com/c/go/+/303729
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Than McIntosh 2021-03-18 11:18:44 -04:00
parent a93849b9e2
commit d9691ffa37
2 changed files with 18 additions and 18 deletions

View File

@ -233,6 +233,24 @@ func walkIf(n *ir.IfStmt) ir.Node {
return n
}
// Rewrite
// go builtin(x, y, z)
// into
// go func(a1, a2, a3) {
// builtin(a1, a2, a3)
// }(x, y, z)
// for print, println, and delete.
//
// Rewrite
// go f(x, y, uintptr(unsafe.Pointer(z)))
// into
// go func(a1, a2, a3) {
// f(a1, a2, uintptr(a3))
// }(x, y, unsafe.Pointer(z))
// for function contains unsafe-uintptr arguments.
var wrapCall_prgen int
// The result of wrapCall MUST be assigned back to n, e.g.
// n.Left = wrapCall(n.Left, init)
func wrapCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {

View File

@ -237,24 +237,6 @@ func walkAppendArgs(n *ir.CallExpr, init *ir.Nodes) {
}
}
// Rewrite
// go builtin(x, y, z)
// into
// go func(a1, a2, a3) {
// builtin(a1, a2, a3)
// }(x, y, z)
// for print, println, and delete.
//
// Rewrite
// go f(x, y, uintptr(unsafe.Pointer(z)))
// into
// go func(a1, a2, a3) {
// builtin(a1, a2, uintptr(a3))
// }(x, y, unsafe.Pointer(z))
// for function contains unsafe-uintptr arguments.
var wrapCall_prgen int
// appendWalkStmt typechecks and walks stmt and then appends it to init.
func appendWalkStmt(init *ir.Nodes, stmt ir.Node) {
op := stmt.Op()