diff options
author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-06-24 23:05:09 +0700 |
---|---|---|
committer | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-06-25 02:29:28 +0000 |
commit | 2493c727425547db935a1c6e519bc19d01476380 (patch) | |
tree | 357aee3a225987ebf5b1000e34d19a9b8b3a430d /src/cmd/compile/internal/escape | |
parent | f190a9280ddcaa958610e104a3f6c105fedd3fee (diff) | |
download | go-2493c727425547db935a1c6e519bc19d01476380.tar.gz go-2493c727425547db935a1c6e519bc19d01476380.zip |
[dev.typeparams] cmd/compile: rewrite method call into method expression during escape analysis
CL 330331 extended escape analysis to analyze method expression calls
the same as normal method calls. We can now simply desugar method calls
into function calls in escape analysis.
To do this, two things must be changed:
- Folding the rewrite method call to method expression call into an
export function in typecheck package, so others can re-use it.
- walkCall now have to call usemethod for method expression calls.
(It seems to me this is a bug in current tip, because if one write
(*rtype).Method(typ, i) in package "reflect", then the function won't
be marked with AttrReflectMethod)
Passes toolstash -cmp.
Change-Id: I4745ab6110b417c7fd32949cc799811a882cd2ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/330671
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/escape')
-rw-r--r-- | src/cmd/compile/internal/escape/call.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/escape/call.go b/src/cmd/compile/internal/escape/call.go index b8e28cd46a..62727a8ef8 100644 --- a/src/cmd/compile/internal/escape/call.go +++ b/src/cmd/compile/internal/escape/call.go @@ -46,6 +46,7 @@ func (e *escape) callCommon(ks []hole, call ir.Node, init *ir.Nodes, wrapper *ir case ir.OCALLFUNC, ir.OCALLMETH, ir.OCALLINTER: call := call.(*ir.CallExpr) typecheck.FixVariadicCall(call) + typecheck.FixMethodCall(call) // Pick out the function callee, if statically known. // |