mirror of
https://github.com/golang/go.git
synced 2025-11-01 01:00:56 +00:00
[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>
This commit is contained in:
parent
e563715b30
commit
4629f6a51d
14 changed files with 58 additions and 154 deletions
|
|
@ -100,7 +100,7 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node {
|
|||
|
||||
case ir.OMETHEXPR:
|
||||
// TODO(mdempsky): Do this right after type checking.
|
||||
n := n.(*ir.MethodExpr)
|
||||
n := n.(*ir.SelectorExpr)
|
||||
return n.FuncName()
|
||||
|
||||
case ir.ONOT, ir.ONEG, ir.OPLUS, ir.OBITNOT, ir.OREAL, ir.OIMAG, ir.OSPTR, ir.OITAB, ir.OIDATA:
|
||||
|
|
@ -306,7 +306,7 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node {
|
|||
return walkClosure(n.(*ir.ClosureExpr), init)
|
||||
|
||||
case ir.OCALLPART:
|
||||
return walkCallPart(n.(*ir.CallPartExpr), init)
|
||||
return walkCallPart(n.(*ir.SelectorExpr), init)
|
||||
}
|
||||
|
||||
// No return! Each case must return (or panic),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue