mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile: call transformArgs before early typecheckaste in noder
In the cases where we do an early call to typecheckaste() in noder to expose CONVIFACE nodes, we need a preceding call to transformArgs(). This is needed to allow typecheckaste() to run correctly, in the case of f(g()), where g has multiple return values. I also cleaned up the code a bit and commented the code in Call(), and we do the call to typecheckaste() in several more cases. In stencil.go:stencil(), I moved the transformCall earlier for the OCALLMETH/ODOTMETH case, just as I did in my previous CL for OCALL/OFUNCINST. By doing this, transformArgs no longer needs to deal with the extra dictionary args. Therefore, I was able to simply transformArgs() to look like typecheckargs() again, and make use of RewriteMultiValue directly. Updates #47514 Change-Id: I49eb82ac05707e50c2e2fb03e39458a70491d406 Reviewed-on: https://go-review.googlesource.com/c/go/+/340531 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
ca3c6985cd
commit
9f4d6a8359
5 changed files with 55 additions and 91 deletions
|
|
@ -161,18 +161,21 @@ func (g *irgen) stencil() {
|
|||
}
|
||||
}
|
||||
|
||||
// Transform the Call now, which changes OCALL
|
||||
// to OCALLFUNC and does typecheckaste/assignconvfn.
|
||||
transformCall(call)
|
||||
|
||||
st := g.getInstantiation(gf, targs, true)
|
||||
dictValue, usingSubdict := g.getDictOrSubdict(declInfo, n, gf, targs, true)
|
||||
// We have to be using a subdictionary, since this is
|
||||
// a generic method call.
|
||||
assert(usingSubdict)
|
||||
|
||||
call.SetOp(ir.OCALL)
|
||||
// Transform to a function call, by appending the
|
||||
// dictionary and the receiver to the args.
|
||||
call.SetOp(ir.OCALLFUNC)
|
||||
call.X = st.Nname
|
||||
call.Args.Prepend(dictValue, meth.X)
|
||||
// Transform the Call now, which changes OCALL
|
||||
// to OCALLFUNC and does typecheckaste/assignconvfn.
|
||||
transformCall(call)
|
||||
modified = true
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue