go/ssa: slight simplification to setCallFunc

Change-Id: I6b8cc35f779910ebab3db9994bb17456a6df4b94
Reviewed-on: https://go-review.googlesource.com/2742
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Alan Donovan 2015-01-12 18:13:41 -05:00
parent d3e7567302
commit 47f2109c64
1 changed files with 4 additions and 3 deletions

View File

@ -747,7 +747,7 @@ func (b *builder) stmtList(fn *Function, list []ast.Stmt) {
// selections of sel. // selections of sel.
// //
// wantAddr requests that the result is an an address. If // wantAddr requests that the result is an an address. If
// !sel.Indirect(), this may require that e be build in addr() mode; it // !sel.Indirect(), this may require that e be built in addr() mode; it
// must thus be addressable. // must thus be addressable.
// //
// escaping is defined as per builder.addr(). // escaping is defined as per builder.addr().
@ -780,10 +780,11 @@ func (b *builder) setCallFunc(fn *Function, e *ast.CallExpr, c *CallCommon) {
sel, ok := fn.Pkg.info.Selections[selector] sel, ok := fn.Pkg.info.Selections[selector]
if ok && sel.Kind() == types.MethodVal { if ok && sel.Kind() == types.MethodVal {
obj := sel.Obj().(*types.Func) obj := sel.Obj().(*types.Func)
wantAddr := isPointer(recvType(obj)) recv := recvType(obj)
wantAddr := isPointer(recv)
escaping := true escaping := true
v := b.receiver(fn, selector.X, wantAddr, escaping, sel) v := b.receiver(fn, selector.X, wantAddr, escaping, sel)
if isInterface(deref(v.Type())) { if isInterface(recv) {
// Invoke-mode call. // Invoke-mode call.
c.Value = v c.Value = v
c.Method = obj c.Method = obj