1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:00:04 -07:00

cmd/compile: improve fncall docs

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>
This commit is contained in:
Josh Bleecher Snyder 2018-05-24 13:31:03 -07:00
parent e52c1c0289
commit 124eccd5f7

View 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)