mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Revert "cmd/compile: rewrite f(g()) for multi-value g() during typecheck"
This reverts commit d96b7fbf98.
Reason for revert: broke noopt and longtest builders.
Change-Id: Ifaec64d817c4336cb255a2e9db00526b7bc5606a
Reviewed-on: https://go-review.googlesource.com/c/164757
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
13d24b685a
commit
38642b9fce
13 changed files with 267 additions and 157 deletions
|
|
@ -589,13 +589,24 @@ func inlnode(n *Node, maxCost int32) *Node {
|
|||
}
|
||||
|
||||
inlnodelist(n.List, maxCost)
|
||||
if n.Op == OBLOCK {
|
||||
switch n.Op {
|
||||
case OBLOCK:
|
||||
for _, n2 := range n.List.Slice() {
|
||||
if n2.Op == OINLCALL {
|
||||
inlconv2stmt(n2)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
case ORETURN, OCALLFUNC, OCALLMETH, OCALLINTER, OAPPEND, OCOMPLEX:
|
||||
// if we just replaced arg in f(arg()) or return arg with an inlined call
|
||||
// and arg returns multiple values, glue as list
|
||||
if n.List.Len() == 1 && n.List.First().Op == OINLCALL && n.List.First().Rlist.Len() > 1 {
|
||||
n.List.Set(inlconv2list(n.List.First()))
|
||||
break
|
||||
}
|
||||
fallthrough
|
||||
|
||||
default:
|
||||
s := n.List.Slice()
|
||||
for i1, n1 := range s {
|
||||
if n1 != nil && n1.Op == OINLCALL {
|
||||
|
|
@ -1005,6 +1016,9 @@ func mkinlcall(n, fn *Node, maxCost int32) *Node {
|
|||
// to pass as a slice.
|
||||
|
||||
numvals := n.List.Len()
|
||||
if numvals == 1 && n.List.First().Type.IsFuncArgStruct() {
|
||||
numvals = n.List.First().Type.NumFields()
|
||||
}
|
||||
|
||||
x := as.List.Len()
|
||||
for as.List.Len() < numvals {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue