From 4629f6a51da5afabbebe9616f65fbfe0675d6039 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Mon, 28 Dec 2020 16:14:11 -0800 Subject: [dev.regabi] cmd/compile: merge {Selector,CallPart,Method}Expr These three expression nodes all represent the same syntax, and so they're represented the same within types2. And also they're not handled that meaningfully differently throughout the rest of the compiler to merit unique representations. Method expressions are somewhat unique today that they're very frequently turned into plain function names. But eventually that can be handled by a post-typecheck desugaring phase that reduces the number of redundant AST forms. Passes toolstash -cmp. Change-Id: I20df91bbd0d885c1f18ec67feb61ae1558670719 Reviewed-on: https://go-review.googlesource.com/c/go/+/280636 Trust: Matthew Dempsky Trust: Dan Scales Run-TryBot: Matthew Dempsky TryBot-Result: Go Bot Reviewed-by: Dan Scales --- src/cmd/compile/internal/typecheck/expr.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/cmd/compile/internal/typecheck/expr.go') diff --git a/src/cmd/compile/internal/typecheck/expr.go b/src/cmd/compile/internal/typecheck/expr.go index 3e7a880c2a..0682548c27 100644 --- a/src/cmd/compile/internal/typecheck/expr.go +++ b/src/cmd/compile/internal/typecheck/expr.go @@ -626,10 +626,8 @@ func tcDot(n *ir.SelectorExpr, top int) ir.Node { } if (n.Op() == ir.ODOTINTER || n.Op() == ir.ODOTMETH) && top&ctxCallee == 0 { - // Create top-level function. - fn := makepartialcall(n) - - return ir.NewCallPartExpr(n.Pos(), n.X, n.Selection, fn) + n.SetOp(ir.OCALLPART) + n.SetType(MethodValueWrapper(n).Type()) } return n } -- cgit v1.2.3-54-g00ecf