]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: improve fncall docs
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 24 May 2018 20:31:03 +0000 (13:31 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 25 May 2018 13:08:56 +0000 (13:08 +0000)
Comment changes only.

Change-Id: I3f9c1c38ae6b4989f02b62fff09265e4bcb934f7
Reviewed-on: https://go-review.googlesource.com/114519
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/walk.go

index 331aefb5de0dfd994fd7b2284edb366e49b1465d..7ae0a1707b4b51cee8b31480e484f5ef3f2aab2e 100644 (file)
@@ -1836,10 +1836,7 @@ func ascompatee(op Op, nl, nr []*Node, init *Nodes) []*Node {
        return nn
 }
 
-// l is an lv and rt is the type of an rv
-// return 1 if this implies a function call
-// evaluating the lv or a function call
-// in the conversion of the types
+// fncall reports whether assigning an rvalue of type rt to an lvalue l might involve a function call.
 func fncall(l *Node, rt *types.Type) bool {
        if l.HasCall() || l.Op == OINDEXMAP {
                return true
@@ -1847,6 +1844,7 @@ func fncall(l *Node, rt *types.Type) bool {
        if eqtype(l.Type, rt) {
                return false
        }
+       // There might be a conversion required, which might involve a runtime call.
        return true
 }
 
@@ -1865,9 +1863,8 @@ func ascompatet(nl Nodes, nr *types.Type) []*Node {
                }
                r := nr.Field(i)
 
-               // any lv that causes a fn call must be
-               // deferred until all the return arguments
-               // have been pulled from the output arguments
+               // Any assignment to an lvalue that might cause a function call must be
+               // deferred until all the returned values have been read.
                if fncall(l, r.Type) {
                        tmp := temp(r.Type)
                        tmp = typecheck(tmp, Erv)