]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile: rename OCALLPART to OMETHVALUE
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sat, 26 Jun 2021 18:28:38 +0000 (01:28 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Sun, 27 Jun 2021 09:38:35 +0000 (09:38 +0000)
Go spec call them "method values", not "partial calls". Note that
we use "OMETHVALUE" (as opposed to "OMETHODVALUE") to be consistent
with "OMETHEXPR".

Change-Id: I1efd985d4b567a1b4b20aeb603eb82db579edbd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/330837
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>
24 files changed:
src/cmd/compile/internal/escape/escape.go
src/cmd/compile/internal/escape/expr.go
src/cmd/compile/internal/escape/utils.go
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ir/fmt.go
src/cmd/compile/internal/ir/func.go
src/cmd/compile/internal/ir/node.go
src/cmd/compile/internal/ir/op_string.go
src/cmd/compile/internal/ir/scc.go
src/cmd/compile/internal/noder/expr.go
src/cmd/compile/internal/noder/helpers.go
src/cmd/compile/internal/noder/stencil.go
src/cmd/compile/internal/noder/transform.go
src/cmd/compile/internal/pkginit/initorder.go
src/cmd/compile/internal/typecheck/const.go
src/cmd/compile/internal/typecheck/crawler.go
src/cmd/compile/internal/typecheck/expr.go
src/cmd/compile/internal/typecheck/func.go
src/cmd/compile/internal/typecheck/iexport.go
src/cmd/compile/internal/typecheck/iimport.go
src/cmd/compile/internal/walk/closure.go
src/cmd/compile/internal/walk/expr.go
src/cmd/compile/internal/walk/order.go

index 317bc98473cd04b3db30c05233bc69336344f4da..04d0c2356c1e3d14085a8dce47f197df29c8900f 100644 (file)
@@ -315,7 +315,7 @@ func (b *batch) finish(fns []*ir.Func) {
                                case ir.OCLOSURE:
                                        n := n.(*ir.ClosureExpr)
                                        n.SetTransient(true)
-                               case ir.OCALLPART:
+                               case ir.OMETHVALUE:
                                        n := n.(*ir.SelectorExpr)
                                        n.SetTransient(true)
                                case ir.OSLICELIT:
index 71c8eec6efc2e7c96225965e36e558e1b2a11d81..dfcd55734abe703c1c8196b65617531cb33dac5b 100644 (file)
@@ -153,7 +153,7 @@ func (e *escape) exprSkipInit(k hole, n ir.Node) {
                e.spill(k, n)
                e.discard(n.Len)
 
-       case ir.OCALLPART:
+       case ir.OMETHVALUE:
                // Flow the receiver argument to both the closure and
                // to the receiver parameter.
 
index 7100926bb85f78374d4227c7207606ab7763af1b..1ac4cc602905c98e2875a02f37c856f0632e77f5 100644 (file)
@@ -193,7 +193,7 @@ func HeapAllocReason(n ir.Node) string {
        if n.Op() == ir.OCLOSURE && typecheck.ClosureType(n.(*ir.ClosureExpr)).Size() >= ir.MaxImplicitStackVarSize {
                return "too large for stack"
        }
-       if n.Op() == ir.OCALLPART && typecheck.PartialCallType(n.(*ir.SelectorExpr)).Size() >= ir.MaxImplicitStackVarSize {
+       if n.Op() == ir.OMETHVALUE && typecheck.PartialCallType(n.(*ir.SelectorExpr)).Size() >= ir.MaxImplicitStackVarSize {
                return "too large for stack"
        }
 
index 3086d093c0485d433bbb45228078577cf7de4df9..a6961e4e4d1c6ea49aa7ac79a7ab62bd09935233 100644 (file)
@@ -416,7 +416,7 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
                // and don't charge for the OBLOCK itself. The ++ undoes the -- below.
                v.budget++
 
-       case ir.OCALLPART, ir.OSLICELIT:
+       case ir.OMETHVALUE, ir.OSLICELIT:
                v.budget-- // Hack for toolstash -cmp.
 
        case ir.OMETHEXPR:
index 81b2c52b87f5fcbe61edb046f25e8a19820b600d..919cb3362fe2c5fc575557523ab5311039e7d465 100644 (file)
@@ -519,7 +519,7 @@ type SelectorExpr struct {
        Sel *types.Sym
        // The actual selected field - may not be filled in until typechecking.
        Selection *types.Field
-       Prealloc  *Name // preallocated storage for OCALLPART, if any
+       Prealloc  *Name // preallocated storage for OMETHVALUE, if any
 }
 
 func NewSelectorExpr(pos src.XPos, op Op, x Node, sel *types.Sym) *SelectorExpr {
@@ -533,7 +533,7 @@ func (n *SelectorExpr) SetOp(op Op) {
        switch op {
        default:
                panic(n.no("SetOp " + op.String()))
-       case OXDOT, ODOT, ODOTPTR, ODOTMETH, ODOTINTER, OCALLPART, OMETHEXPR:
+       case OXDOT, ODOT, ODOTPTR, ODOTMETH, ODOTINTER, OMETHVALUE, OMETHEXPR:
                n.op = op
        }
 }
@@ -1098,7 +1098,7 @@ func MethodExprName(n Node) *Name {
 // MethodExprFunc is like MethodExprName, but returns the types.Field instead.
 func MethodExprFunc(n Node) *types.Field {
        switch n.Op() {
-       case ODOTMETH, OMETHEXPR, OCALLPART:
+       case ODOTMETH, OMETHEXPR, OMETHVALUE:
                return n.(*SelectorExpr).Selection
        }
        base.Fatalf("unexpected node: %v (%v)", n, n.Op())
index d9cc5f109f5810dd7646da585734257ad481b0f1..ae62d5f51b99aea2839f34b06932a2412c63b504 100644 (file)
@@ -237,7 +237,7 @@ var OpPrec = []int{
        ODOTTYPE:       8,
        ODOT:           8,
        OXDOT:          8,
-       OCALLPART:      8,
+       OMETHVALUE:     8,
        OMETHEXPR:      8,
        OPLUS:          7,
        ONOT:           7,
@@ -757,7 +757,7 @@ func exprFmt(n Node, s fmt.State, prec int) {
                n := n.(*StructKeyExpr)
                fmt.Fprintf(s, "%v:%v", n.Field, n.Value)
 
-       case OXDOT, ODOT, ODOTPTR, ODOTINTER, ODOTMETH, OCALLPART, OMETHEXPR:
+       case OXDOT, ODOT, ODOTPTR, ODOTINTER, ODOTMETH, OMETHVALUE, OMETHEXPR:
                n := n.(*SelectorExpr)
                exprFmt(n.X, s, nprec)
                if n.Sel == nil {
index 3501f83ab1d0743da0420a823eb61b56ebc28c5d..3b9e36d4c59691066e766cb260f020e69c15e4aa 100644 (file)
@@ -40,14 +40,14 @@ import (
 // constructs a fresh node.
 //
 // A method value (t.M) is represented by ODOTMETH/ODOTINTER
-// when it is called directly and by OCALLPART otherwise.
+// when it is called directly and by OMETHVALUE otherwise.
 // These are like method expressions, except that for ODOTMETH/ODOTINTER,
 // the method name is stored in Sym instead of Right.
-// Each OCALLPART ends up being implemented as a new
+// Each OMETHVALUE ends up being implemented as a new
 // function, a bit like a closure, with its own ODCLFUNC.
-// The OCALLPART uses n.Func to record the linkage to
+// The OMETHVALUE uses n.Func to record the linkage to
 // the generated ODCLFUNC, but there is no
-// pointer from the Func back to the OCALLPART.
+// pointer from the Func back to the OMETHVALUE.
 type Func struct {
        miniNode
        Body Nodes
index fa7c9cc27609a0abc99f31edc41a88ad1a003476..f6eae58b040c7e0b2db9be8a6f49e4ba2b99595b 100644 (file)
@@ -159,7 +159,6 @@ const (
        OCALLFUNC  // X(Args) (function call f(args))
        OCALLMETH  // X(Args) (direct method call x.Method(args))
        OCALLINTER // X(Args) (interface method call x.Method(args))
-       OCALLPART  // X.Sel (method expression x.Method, not called)
        OCAP       // cap(X)
        OCLOSE     // close(X)
        OCLOSURE   // func Type { Func.Closure.Body } (func literal)
@@ -250,7 +249,8 @@ const (
        OSIZEOF      // unsafe.Sizeof(X)
        OUNSAFEADD   // unsafe.Add(X, Y)
        OUNSAFESLICE // unsafe.Slice(X, Y)
-       OMETHEXPR    // method expression
+       OMETHEXPR    // X(Args) (method expression T.Method(args), first argument is the method receiver)
+       OMETHVALUE   // X.Sel   (method expression t.Method, not called)
 
        // statements
        OBLOCK // { List } (block of code)
index 80c8d09c1e42ecff64904ae2f4f3ac13e1bbbd9e..05a37a60b1d853a1648d63ee4cf0bca0356ef9f2 100644 (file)
@@ -41,88 +41,88 @@ func _() {
        _ = x[OCALLFUNC-30]
        _ = x[OCALLMETH-31]
        _ = x[OCALLINTER-32]
-       _ = x[OCALLPART-33]
-       _ = x[OCAP-34]
-       _ = x[OCLOSE-35]
-       _ = x[OCLOSURE-36]
-       _ = x[OCOMPLIT-37]
-       _ = x[OMAPLIT-38]
-       _ = x[OSTRUCTLIT-39]
-       _ = x[OARRAYLIT-40]
-       _ = x[OSLICELIT-41]
-       _ = x[OPTRLIT-42]
-       _ = x[OCONV-43]
-       _ = x[OCONVIFACE-44]
-       _ = x[OCONVNOP-45]
-       _ = x[OCOPY-46]
-       _ = x[ODCL-47]
-       _ = x[ODCLFUNC-48]
-       _ = x[ODCLCONST-49]
-       _ = x[ODCLTYPE-50]
-       _ = x[ODELETE-51]
-       _ = x[ODOT-52]
-       _ = x[ODOTPTR-53]
-       _ = x[ODOTMETH-54]
-       _ = x[ODOTINTER-55]
-       _ = x[OXDOT-56]
-       _ = x[ODOTTYPE-57]
-       _ = x[ODOTTYPE2-58]
-       _ = x[OEQ-59]
-       _ = x[ONE-60]
-       _ = x[OLT-61]
-       _ = x[OLE-62]
-       _ = x[OGE-63]
-       _ = x[OGT-64]
-       _ = x[ODEREF-65]
-       _ = x[OINDEX-66]
-       _ = x[OINDEXMAP-67]
-       _ = x[OKEY-68]
-       _ = x[OSTRUCTKEY-69]
-       _ = x[OLEN-70]
-       _ = x[OMAKE-71]
-       _ = x[OMAKECHAN-72]
-       _ = x[OMAKEMAP-73]
-       _ = x[OMAKESLICE-74]
-       _ = x[OMAKESLICECOPY-75]
-       _ = x[OMUL-76]
-       _ = x[ODIV-77]
-       _ = x[OMOD-78]
-       _ = x[OLSH-79]
-       _ = x[ORSH-80]
-       _ = x[OAND-81]
-       _ = x[OANDNOT-82]
-       _ = x[ONEW-83]
-       _ = x[ONOT-84]
-       _ = x[OBITNOT-85]
-       _ = x[OPLUS-86]
-       _ = x[ONEG-87]
-       _ = x[OOROR-88]
-       _ = x[OPANIC-89]
-       _ = x[OPRINT-90]
-       _ = x[OPRINTN-91]
-       _ = x[OPAREN-92]
-       _ = x[OSEND-93]
-       _ = x[OSLICE-94]
-       _ = x[OSLICEARR-95]
-       _ = x[OSLICESTR-96]
-       _ = x[OSLICE3-97]
-       _ = x[OSLICE3ARR-98]
-       _ = x[OSLICEHEADER-99]
-       _ = x[ORECOVER-100]
-       _ = x[ORECOVERFP-101]
-       _ = x[ORECV-102]
-       _ = x[ORUNESTR-103]
-       _ = x[OSELRECV2-104]
-       _ = x[OIOTA-105]
-       _ = x[OREAL-106]
-       _ = x[OIMAG-107]
-       _ = x[OCOMPLEX-108]
-       _ = x[OALIGNOF-109]
-       _ = x[OOFFSETOF-110]
-       _ = x[OSIZEOF-111]
-       _ = x[OUNSAFEADD-112]
-       _ = x[OUNSAFESLICE-113]
-       _ = x[OMETHEXPR-114]
+       _ = x[OCAP-33]
+       _ = x[OCLOSE-34]
+       _ = x[OCLOSURE-35]
+       _ = x[OCOMPLIT-36]
+       _ = x[OMAPLIT-37]
+       _ = x[OSTRUCTLIT-38]
+       _ = x[OARRAYLIT-39]
+       _ = x[OSLICELIT-40]
+       _ = x[OPTRLIT-41]
+       _ = x[OCONV-42]
+       _ = x[OCONVIFACE-43]
+       _ = x[OCONVNOP-44]
+       _ = x[OCOPY-45]
+       _ = x[ODCL-46]
+       _ = x[ODCLFUNC-47]
+       _ = x[ODCLCONST-48]
+       _ = x[ODCLTYPE-49]
+       _ = x[ODELETE-50]
+       _ = x[ODOT-51]
+       _ = x[ODOTPTR-52]
+       _ = x[ODOTMETH-53]
+       _ = x[ODOTINTER-54]
+       _ = x[OXDOT-55]
+       _ = x[ODOTTYPE-56]
+       _ = x[ODOTTYPE2-57]
+       _ = x[OEQ-58]
+       _ = x[ONE-59]
+       _ = x[OLT-60]
+       _ = x[OLE-61]
+       _ = x[OGE-62]
+       _ = x[OGT-63]
+       _ = x[ODEREF-64]
+       _ = x[OINDEX-65]
+       _ = x[OINDEXMAP-66]
+       _ = x[OKEY-67]
+       _ = x[OSTRUCTKEY-68]
+       _ = x[OLEN-69]
+       _ = x[OMAKE-70]
+       _ = x[OMAKECHAN-71]
+       _ = x[OMAKEMAP-72]
+       _ = x[OMAKESLICE-73]
+       _ = x[OMAKESLICECOPY-74]
+       _ = x[OMUL-75]
+       _ = x[ODIV-76]
+       _ = x[OMOD-77]
+       _ = x[OLSH-78]
+       _ = x[ORSH-79]
+       _ = x[OAND-80]
+       _ = x[OANDNOT-81]
+       _ = x[ONEW-82]
+       _ = x[ONOT-83]
+       _ = x[OBITNOT-84]
+       _ = x[OPLUS-85]
+       _ = x[ONEG-86]
+       _ = x[OOROR-87]
+       _ = x[OPANIC-88]
+       _ = x[OPRINT-89]
+       _ = x[OPRINTN-90]
+       _ = x[OPAREN-91]
+       _ = x[OSEND-92]
+       _ = x[OSLICE-93]
+       _ = x[OSLICEARR-94]
+       _ = x[OSLICESTR-95]
+       _ = x[OSLICE3-96]
+       _ = x[OSLICE3ARR-97]
+       _ = x[OSLICEHEADER-98]
+       _ = x[ORECOVER-99]
+       _ = x[ORECOVERFP-100]
+       _ = x[ORECV-101]
+       _ = x[ORUNESTR-102]
+       _ = x[OSELRECV2-103]
+       _ = x[OIOTA-104]
+       _ = x[OREAL-105]
+       _ = x[OIMAG-106]
+       _ = x[OCOMPLEX-107]
+       _ = x[OALIGNOF-108]
+       _ = x[OOFFSETOF-109]
+       _ = x[OSIZEOF-110]
+       _ = x[OUNSAFEADD-111]
+       _ = x[OUNSAFESLICE-112]
+       _ = x[OMETHEXPR-113]
+       _ = x[OMETHVALUE-114]
        _ = x[OBLOCK-115]
        _ = x[OBREAK-116]
        _ = x[OCASE-117]
@@ -168,9 +168,9 @@ func _() {
        _ = x[OEND-157]
 }
 
-const _Op_name = "XXXNAMENONAMETYPEPACKLITERALNILADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESSLICE2ARRPTRASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCALLPARTCAPCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVNOPCOPYDCLDCLFUNCDCLCONSTDCLTYPEDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMAKESLICECOPYMULDIVMODLSHRSHANDANDNOTNEWNOTBITNOTPLUSNEGORORPANICPRINTPRINTNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERRECOVERRECOVERFPRECVRUNESTRSELRECV2IOTAREALIMAGCOMPLEXALIGNOFOFFSETOFSIZEOFUNSAFEADDUNSAFESLICEMETHEXPRBLOCKBREAKCASECONTINUEDEFERFALLFORFORUNTILGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWFUNCINSTTCHANTMAPTSTRUCTTINTERTFUNCTARRAYTSLICEINLCALLEFACEITABIDATASPTRCFUNCCHECKNILVARDEFVARKILLVARLIVERESULTINLMARKLINKSYMOFFSETTAILCALLGETGGETCALLERPCGETCALLERSPEND"
+const _Op_name = "XXXNAMENONAMETYPEPACKLITERALNILADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESSLICE2ARRPTRASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCAPCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVNOPCOPYDCLDCLFUNCDCLCONSTDCLTYPEDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMAKESLICECOPYMULDIVMODLSHRSHANDANDNOTNEWNOTBITNOTPLUSNEGORORPANICPRINTPRINTNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERRECOVERRECOVERFPRECVRUNESTRSELRECV2IOTAREALIMAGCOMPLEXALIGNOFOFFSETOFSIZEOFUNSAFEADDUNSAFESLICEMETHEXPRMETHVALUEBLOCKBREAKCASECONTINUEDEFERFALLFORFORUNTILGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWFUNCINSTTCHANTMAPTSTRUCTTINTERTFUNCTARRAYTSLICEINLCALLEFACEITABIDATASPTRCFUNCCHECKNILVARDEFVARKILLVARLIVERESULTINLMARKLINKSYMOFFSETTAILCALLGETGGETCALLERPCGETCALLERSPEND"
 
-var _Op_index = [...]uint16{0, 3, 7, 13, 17, 21, 28, 31, 34, 37, 39, 42, 48, 52, 58, 64, 73, 85, 94, 103, 115, 124, 136, 138, 141, 151, 158, 165, 172, 176, 180, 188, 196, 205, 213, 216, 221, 228, 235, 241, 250, 258, 266, 272, 276, 285, 292, 296, 299, 306, 314, 321, 327, 330, 336, 343, 351, 355, 362, 370, 372, 374, 376, 378, 380, 382, 387, 392, 400, 403, 412, 415, 419, 427, 434, 443, 456, 459, 462, 465, 468, 471, 474, 480, 483, 486, 492, 496, 499, 503, 508, 513, 519, 524, 528, 533, 541, 549, 555, 564, 575, 582, 591, 595, 602, 610, 614, 618, 622, 629, 636, 644, 650, 659, 670, 678, 683, 688, 692, 700, 705, 709, 712, 720, 724, 726, 731, 733, 738, 744, 750, 756, 762, 770, 775, 779, 786, 792, 797, 803, 809, 816, 821, 825, 830, 834, 839, 847, 853, 860, 867, 873, 880, 893, 901, 905, 916, 927, 930}
+var _Op_index = [...]uint16{0, 3, 7, 13, 17, 21, 28, 31, 34, 37, 39, 42, 48, 52, 58, 64, 73, 85, 94, 103, 115, 124, 136, 138, 141, 151, 158, 165, 172, 176, 180, 188, 196, 205, 208, 213, 220, 227, 233, 242, 250, 258, 264, 268, 277, 284, 288, 291, 298, 306, 313, 319, 322, 328, 335, 343, 347, 354, 362, 364, 366, 368, 370, 372, 374, 379, 384, 392, 395, 404, 407, 411, 419, 426, 435, 448, 451, 454, 457, 460, 463, 466, 472, 475, 478, 484, 488, 491, 495, 500, 505, 511, 516, 520, 525, 533, 541, 547, 556, 567, 574, 583, 587, 594, 602, 606, 610, 614, 621, 628, 636, 642, 651, 662, 670, 679, 684, 689, 693, 701, 706, 710, 713, 721, 725, 727, 732, 734, 739, 745, 751, 757, 763, 771, 776, 780, 787, 793, 798, 804, 810, 817, 822, 826, 831, 835, 840, 848, 854, 861, 868, 874, 881, 894, 902, 906, 917, 928, 931}
 
 func (i Op) String() string {
        if i >= Op(len(_Op_index)-1) {
index 83c6074170b31370e0e6c6e71f35e56533204d2b..2cfceaa1f627fa1e4d7773b828278ecd94dd902f 100644 (file)
@@ -90,7 +90,7 @@ func (v *bottomUpVisitor) visit(n *Func) uint32 {
                        if n := n.(*Name); n.Class == PFUNC {
                                do(n.Defn)
                        }
-               case ODOTMETH, OCALLPART, OMETHEXPR:
+               case ODOTMETH, OMETHVALUE, OMETHEXPR:
                        if fn := MethodExprName(n); fn != nil {
                                do(fn.Defn)
                        }
index 98dc504ee98c4aba8b80b72dac7fbaceaac0e09d..017e98986fb524a1acef2b93bc2401e445c8c2e0 100644 (file)
@@ -196,7 +196,7 @@ func (g *irgen) expr0(typ types2.Type, expr syntax.Expr) ir.Node {
        }
 }
 
-// selectorExpr resolves the choice of ODOT, ODOTPTR, OCALLPART (eventually
+// selectorExpr resolves the choice of ODOT, ODOTPTR, OMETHVALUE (eventually
 // ODOTMETH & ODOTINTER), and OMETHEXPR and deals with embedded fields here rather
 // than in typecheck.go.
 func (g *irgen) selectorExpr(pos src.XPos, typ types2.Type, expr *syntax.SelectorExpr) ir.Node {
@@ -273,7 +273,7 @@ func (g *irgen) selectorExpr(pos src.XPos, typ types2.Type, expr *syntax.Selecto
                                // the base generic type. The instantiated type may not
                                // have method bodies filled in, if it was imported.
                                method := recvType.Methods().Index(last).Nname.(*ir.Name)
-                               n = ir.NewSelectorExpr(pos, ir.OCALLPART, x, typecheck.Lookup(expr.Sel.Value))
+                               n = ir.NewSelectorExpr(pos, ir.OMETHVALUE, x, typecheck.Lookup(expr.Sel.Value))
                                n.(*ir.SelectorExpr).Selection = types.NewField(pos, method.Sym(), method.Type())
                                n.(*ir.SelectorExpr).Selection.Nname = method
                                typed(method.Type(), n)
index 456df312a6d2b538c96cdefd6af28ded43aea150..6ab318318bb3e64b383deb8ad8077631b8fb2dce 100644 (file)
@@ -166,7 +166,7 @@ func Call(pos src.XPos, typ *types.Type, fun ir.Node, args []ir.Node, dots bool)
        case *ir.ClosureExpr:
                fun.Func.SetClosureCalled(true)
        case *ir.SelectorExpr:
-               if fun.Op() == ir.OCALLPART {
+               if fun.Op() == ir.OMETHVALUE {
                        op := ir.ODOTMETH
                        if fun.X.Type().IsInterface() {
                                op = ir.ODOTINTER
@@ -251,7 +251,7 @@ func DotMethod(pos src.XPos, x ir.Node, index int) *ir.SelectorExpr {
 
        // Method value.
        typ := typecheck.NewMethodType(method.Type, nil)
-       return dot(pos, typ, ir.OCALLPART, x, method)
+       return dot(pos, typ, ir.OMETHVALUE, x, method)
 }
 
 // MethodExpr returns a OMETHEXPR node with the indicated index into the methods
index 1917c95be711f30d706e0fa3d51ec9826848e7fc..60d56c206f6d0f29491e964e7b650fff5ebfb710 100644 (file)
@@ -103,7 +103,7 @@ func (g *irgen) stencil() {
                                inst := call.X.(*ir.InstExpr)
                                st, dict := g.getInstantiationForNode(inst)
                                if infoPrintMode && g.target.Stencils[decl.Sym()] == nil {
-                                       if inst.X.Op() == ir.OCALLPART {
+                                       if inst.X.Op() == ir.OMETHVALUE {
                                                fmt.Printf("Main dictionary in %v at generic method call: %v - %v\n", decl, inst.X, call)
                                        } else {
                                                fmt.Printf("Main dictionary in %v at generic function call: %v - %v\n", decl, inst.X, call)
@@ -112,7 +112,7 @@ func (g *irgen) stencil() {
                                // Replace the OFUNCINST with a direct reference to the
                                // new stenciled function
                                call.X = st.Nname
-                               if inst.X.Op() == ir.OCALLPART {
+                               if inst.X.Op() == ir.OMETHVALUE {
                                        // When we create an instantiation of a method
                                        // call, we make it a function. So, move the
                                        // receiver to be the first arg of the function
@@ -218,7 +218,7 @@ func (g *irgen) buildClosure(outer *ir.Func, x ir.Node) ir.Node {
                if inst.X.Op() == ir.ONAME {
                        // Instantiating a generic function call.
                        gf = inst.X.(*ir.Name)
-               } else if inst.X.Op() == ir.OCALLPART {
+               } else if inst.X.Op() == ir.OMETHVALUE {
                        // Instantiating a method value x.M.
                        se := inst.X.(*ir.SelectorExpr)
                        rcvrValue = se.X
@@ -826,7 +826,7 @@ func (subst *subster) node(n ir.Node) ir.Node {
                        // instantiated receiver type. We need to do this now,
                        // since the access/selection to the method for the real
                        // type is very different from the selection for the type
-                       // param. m will be transformed to an OCALLPART node. It
+                       // param. m will be transformed to an OMETHVALUE node. It
                        // will be transformed to an ODOTMETH or ODOTINTER node if
                        // we find in the OCALL case below that the method value
                        // is actually called.
@@ -841,7 +841,7 @@ func (subst *subster) node(n ir.Node) ir.Node {
                                // type argument.
                                m = transformConvCall(m.(*ir.CallExpr))
 
-                       case ir.OCALLPART:
+                       case ir.OMETHVALUE:
                                // Redo the transformation of OXDOT, now that we
                                // know the method value is being called. Then
                                // transform the call.
index 30d6e34ae4ef3541347289a28166413cd21a15d3..660c4a19e66bbd8ad666f524b3d59f9dce629a5f 100644 (file)
@@ -564,7 +564,7 @@ func transformAsOp(n *ir.AssignOpStmt) {
 }
 
 // transformDot transforms an OXDOT (or ODOT) or ODOT, ODOTPTR, ODOTMETH,
-// ODOTINTER, or OCALLPART, as appropriate. It adds in extra nodes as needed to
+// ODOTINTER, or OMETHVALUE, as appropriate. It adds in extra nodes as needed to
 // access embedded fields. Corresponds to typecheck.tcDot.
 func transformDot(n *ir.SelectorExpr, isCall bool) ir.Node {
        assert(n.Type() != nil && n.Typecheck() == 1)
@@ -588,7 +588,7 @@ func transformDot(n *ir.SelectorExpr, isCall bool) ir.Node {
        assert(f != nil)
 
        if (n.Op() == ir.ODOTINTER || n.Op() == ir.ODOTMETH) && !isCall {
-               n.SetOp(ir.OCALLPART)
+               n.SetOp(ir.OMETHVALUE)
                if len(n.X.Type().RParams()) > 0 || n.X.Type().IsPtr() && len(n.X.Type().Elem().RParams()) > 0 {
                        // TODO: MethodValueWrapper needed for generics?
                        // Or did we successfully desugar all that at stencil time?
index 97d69629fbae9e5167ec68abe39c9264a8c979cc..0aad63a69f6b05fa6c9a41a5c5fb65d9cf092d16 100644 (file)
@@ -304,7 +304,7 @@ func (d *initDeps) visit(n ir.Node) {
                n := n.(*ir.ClosureExpr)
                d.inspectList(n.Func.Body)
 
-       case ir.ODOTMETH, ir.OCALLPART, ir.OMETHEXPR:
+       case ir.ODOTMETH, ir.OMETHVALUE, ir.OMETHEXPR:
                d.foundDep(ir.MethodExprName(n))
        }
 }
index 761b043794062d7dbb4c985d99319b35ba24f3eb..f8150d249a61c624d328814a9288fbb3ad2fb2ca 100644 (file)
@@ -901,7 +901,7 @@ func evalunsafe(n ir.Node) int64 {
                switch tsel.Op() {
                case ir.ODOT, ir.ODOTPTR:
                        break
-               case ir.OCALLPART:
+               case ir.OMETHVALUE:
                        base.Errorf("invalid expression %v: argument is a method value", n)
                        return 0
                default:
index 655ac6e4654996af3e90a9c6f4391fae0e92d06c..9a348b9f37401dc28a557192486eaa5893390dbf 100644 (file)
@@ -201,7 +201,7 @@ func (p *crawler) markInlBody(n *ir.Name) {
                        p.checkGenericType(n.Type())
                case ir.OTYPE:
                        p.checkGenericType(n.Type())
-               case ir.OCALLPART:
+               case ir.OMETHVALUE:
                        // Okay, because we don't yet inline indirect
                        // calls to method values.
                case ir.OCLOSURE:
index d52f011072852e5fec54e0950540310f74e983d1..f039cbab08d485c2b4a4e8cad32035db41e90ab1 100644 (file)
@@ -541,7 +541,7 @@ func tcDot(n *ir.SelectorExpr, top int) ir.Node {
        }
 
        if (n.Op() == ir.ODOTINTER || n.Op() == ir.ODOTMETH) && top&ctxCallee == 0 {
-               n.SetOp(ir.OCALLPART)
+               n.SetOp(ir.OMETHVALUE)
                n.SetType(MethodValueWrapper(n).Type())
        }
        return n
index 20b991be56af9a4618dda11ed1d0d8c2a9d905db..f4fcfddcf178702558c380dd281af0fff09f9e3c 100644 (file)
@@ -126,7 +126,7 @@ func ClosureType(clo *ir.ClosureExpr) *types.Type {
 }
 
 // PartialCallType returns the struct type used to hold all the information
-// needed in the closure for n (n must be a OCALLPART node).
+// needed in the closure for n (n must be a OMETHVALUE node).
 // The address of a variable of the returned type can be cast to a func.
 func PartialCallType(n *ir.SelectorExpr) *types.Type {
        t := types.NewStruct(types.NoPkg, []*types.Field{
@@ -225,7 +225,7 @@ func fnpkg(fn *ir.Name) *types.Pkg {
 //
 // TODO(mdempsky): Move into walk. This isn't part of type checking.
 func MethodValueWrapper(dot *ir.SelectorExpr) *ir.Func {
-       if dot.Op() != ir.OCALLPART {
+       if dot.Op() != ir.OMETHVALUE {
                base.Fatalf("MethodValueWrapper: unexpected %v (%v)", dot, dot.Op())
        }
 
index 10d4bd6e7eefb6a6b116c0cbcbad4b043983a863..b17af815ec8dfd6f59ea19739876f75b3d52f728 100644 (file)
@@ -1775,7 +1775,7 @@ func (w *exportWriter) expr(n ir.Node) {
        // case OSTRUCTKEY:
        //      unreachable - handled in case OSTRUCTLIT by elemList
 
-       case ir.OXDOT, ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.ODOTMETH, ir.OCALLPART, ir.OMETHEXPR:
+       case ir.OXDOT, ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.ODOTMETH, ir.OMETHVALUE, ir.OMETHEXPR:
                n := n.(*ir.SelectorExpr)
                if go117ExportTypes {
                        // For go117ExportTypes, we usually see all ops except
@@ -1792,7 +1792,7 @@ func (w *exportWriter) expr(n ir.Node) {
                        if n.Op() == ir.ODOT || n.Op() == ir.ODOTPTR || n.Op() == ir.ODOTINTER {
                                w.exoticField(n.Selection)
                        }
-                       // n.Selection is not required for OMETHEXPR, ODOTMETH, and OCALLPART. It will
+                       // n.Selection is not required for OMETHEXPR, ODOTMETH, and OMETHVALUE. It will
                        // be reconstructed during import.  n.Selection is computed during
                        // transformDot() for OXDOT.
                }
index d94f649a4520fa1f31e14b668f55d8d656622e32..7b61260e7988b6ca7af008b0116767235c07e36b 100644 (file)
@@ -1357,7 +1357,7 @@ func (r *importReader) node() ir.Node {
        // case OSTRUCTKEY:
        //      unreachable - handled in case OSTRUCTLIT by elemList
 
-       case ir.OXDOT, ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.ODOTMETH, ir.OCALLPART, ir.OMETHEXPR:
+       case ir.OXDOT, ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.ODOTMETH, ir.OMETHVALUE, ir.OMETHEXPR:
                // For !go117ExportTypes,  we should only see OXDOT.
                // For go117ExportTypes, we usually see all the other ops, but can see
                // OXDOT for generic functions.
@@ -1373,12 +1373,12 @@ func (r *importReader) node() ir.Node {
                        switch op {
                        case ir.ODOT, ir.ODOTPTR, ir.ODOTINTER:
                                n.Selection = r.exoticField()
-                       case ir.ODOTMETH, ir.OCALLPART, ir.OMETHEXPR:
+                       case ir.ODOTMETH, ir.OMETHVALUE, ir.OMETHEXPR:
                                // These require a Lookup to link to the correct declaration.
                                rcvrType := expr.Type()
                                typ := n.Type()
                                n.Selection = Lookdot(n, rcvrType, 1)
-                               if op == ir.OCALLPART || op == ir.OMETHEXPR {
+                               if op == ir.OMETHVALUE || op == ir.OMETHEXPR {
                                        // Lookdot clobbers the opcode and type, undo that.
                                        n.SetOp(op)
                                        n.SetType(typ)
index 2b7fe8f926b38d2e2f8d8de368a9b7ed21bbeb15..f399a26689f9f0146ff642f89c90dbf6476a477d 100644 (file)
@@ -156,7 +156,7 @@ func closureArgs(clo *ir.ClosureExpr) []ir.Node {
        return args
 }
 
-func walkCallPart(n *ir.SelectorExpr, init *ir.Nodes) ir.Node {
+func walkMethodValue(n *ir.SelectorExpr, init *ir.Nodes) ir.Node {
        // Create closure in the form of a composite literal.
        // For x.M with receiver (x) type T, the generated code looks like:
        //
index f7675c3b7d05de37db92a95c3f10381e65fb7490..19fb18852644c2f34f8923ab34bc711bfbff5043 100644 (file)
@@ -308,8 +308,8 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node {
        case ir.OCLOSURE:
                return walkClosure(n.(*ir.ClosureExpr), init)
 
-       case ir.OCALLPART:
-               return walkCallPart(n.(*ir.SelectorExpr), init)
+       case ir.OMETHVALUE:
+               return walkMethodValue(n.(*ir.SelectorExpr), init)
        }
 
        // No return! Each case must return (or panic),
index 16a124d2ff1a542f776f95279a401092aea7864d..007af03d4bb3bdccb2ee9c59d1ee523defb2db28 100644 (file)
@@ -1275,7 +1275,7 @@ func (o *orderState) expr1(n, lhs ir.Node) ir.Node {
                }
                return n
 
-       case ir.OCALLPART:
+       case ir.OMETHVALUE:
                n := n.(*ir.SelectorExpr)
                n.X = o.expr(n.X, nil)
                if n.Transient() {