From 124eccd5f732f532103b1d332a140419966d60c2 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Thu, 24 May 2018 13:31:03 -0700 Subject: [PATCH] cmd/compile: improve fncall docs Comment changes only. Change-Id: I3f9c1c38ae6b4989f02b62fff09265e4bcb934f7 Reviewed-on: https://go-review.googlesource.com/114519 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/cmd/compile/internal/gc/walk.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 331aefb5de..7ae0a1707b 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -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) -- 2.48.1