aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iexport.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-28 16:14:11 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-29 02:35:04 +0000
commit4629f6a51da5afabbebe9616f65fbfe0675d6039 (patch)
tree8e81fbaa7ef4a2efc7cbc750df95c0eb817a4bee /src/cmd/compile/internal/typecheck/iexport.go
parente563715b3085f44a76564485214e33e3c3b2b7b0 (diff)
downloadgo-4629f6a51da5afabbebe9616f65fbfe0675d6039.tar.gz
go-4629f6a51da5afabbebe9616f65fbfe0675d6039.zip
[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 <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iexport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iexport.go21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go
index 3b071a61ab..e35cbcafa2 100644
--- a/src/cmd/compile/internal/typecheck/iexport.go
+++ b/src/cmd/compile/internal/typecheck/iexport.go
@@ -1252,17 +1252,6 @@ func (w *exportWriter) expr(n ir.Node) {
w.pos(n.Pos())
w.value(n.Type(), n.Val())
- case ir.OMETHEXPR:
- // Special case: explicit name of func (*T) method(...) is turned into pkg.(*T).method,
- // but for export, this should be rendered as (*pkg.T).meth.
- // These nodes have the special property that they are names with a left OTYPE and a right ONAME.
- n := n.(*ir.MethodExpr)
- w.op(ir.OXDOT)
- w.pos(n.Pos())
- w.op(ir.OTYPE)
- w.typ(n.T) // n.Left.Op == OTYPE
- w.selector(n.Method.Sym)
-
case ir.ONAME:
// Package scope name.
n := n.(*ir.Name)
@@ -1336,15 +1325,7 @@ func (w *exportWriter) expr(n ir.Node) {
// case OSTRUCTKEY:
// unreachable - handled in case OSTRUCTLIT by elemList
- case ir.OCALLPART:
- // An OCALLPART is an OXDOT before type checking.
- n := n.(*ir.CallPartExpr)
- w.op(ir.OXDOT)
- w.pos(n.Pos())
- w.expr(n.X)
- w.selector(n.Method.Sym)
-
- case ir.OXDOT, ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.ODOTMETH:
+ case ir.OXDOT, ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.ODOTMETH, ir.OCALLPART, ir.OMETHEXPR:
n := n.(*ir.SelectorExpr)
w.op(ir.OXDOT)
w.pos(n.Pos())