mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: bulk rename
This change does a bulk rename of several identifiers in the compiler. See #27167 and https://docs.google.com/document/d/19_ExiylD9MRfeAjKIfEsMU1_RGhuxB9sA0b5Zv7byVI/ for context and for discussion of these particular renames. Commands run to generate this change: gorename -from '"cmd/compile/internal/gc".OPROC' -to OGO gorename -from '"cmd/compile/internal/gc".OCOM' -to OBITNOT gorename -from '"cmd/compile/internal/gc".OMINUS' -to ONEG gorename -from '"cmd/compile/internal/gc".OIND' -to ODEREF gorename -from '"cmd/compile/internal/gc".OARRAYBYTESTR' -to OBYTES2STR gorename -from '"cmd/compile/internal/gc".OARRAYBYTESTRTMP' -to OBYTES2STRTMP gorename -from '"cmd/compile/internal/gc".OARRAYRUNESTR' -to ORUNES2STR gorename -from '"cmd/compile/internal/gc".OSTRARRAYBYTE' -to OSTR2BYTES gorename -from '"cmd/compile/internal/gc".OSTRARRAYBYTETMP' -to OSTR2BYTESTMP gorename -from '"cmd/compile/internal/gc".OSTRARRAYRUNE' -to OSTR2RUNES gorename -from '"cmd/compile/internal/gc".Etop' -to ctxStmt gorename -from '"cmd/compile/internal/gc".Erv' -to ctxExpr gorename -from '"cmd/compile/internal/gc".Ecall' -to ctxCallee gorename -from '"cmd/compile/internal/gc".Efnstruct' -to ctxMultiOK gorename -from '"cmd/compile/internal/gc".Easgn' -to ctxAssign gorename -from '"cmd/compile/internal/gc".Ecomplit' -to ctxCompLit Not altered: parameters and local variables (mostly in typecheck.go) named top, which should probably now be called ctx (and which should probably have a named type). Also not altered: Field called Top in gc.Func. gorename -from '"cmd/compile/internal/gc".Node.Isddd' -to IsDDD gorename -from '"cmd/compile/internal/gc".Node.SetIsddd' -to SetIsDDD gorename -from '"cmd/compile/internal/gc".nodeIsddd' -to nodeIsDDD gorename -from '"cmd/compile/internal/types".Field.Isddd' -to IsDDD gorename -from '"cmd/compile/internal/types".Field.SetIsddd' -to SetIsDDD gorename -from '"cmd/compile/internal/types".fieldIsddd' -to fieldIsDDD Not altered: function gc.hasddd, params and local variables called isddd Also not altered: fmt.go prints nodes using "isddd(%v)". cd cmd/compile/internal/gc; go generate I then manually found impacted comments using exact string match and fixed them up by hand. The comment changes were trivial. Passes toolstash-check. Fixes #27167. If this experiment is deemed a success, we will open a new tracking issue for renames to do at the end of the 1.13 cycles. Change-Id: I2dc541533d2ab0d06cb3d31d65df205ecfb151e8 Reviewed-on: https://go-review.googlesource.com/c/150140 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
404ab866d1
commit
bc43889566
28 changed files with 708 additions and 708 deletions
|
|
@ -411,7 +411,7 @@ func staticassign(l *Node, r *Node, out *[]*Node) bool {
|
|||
}
|
||||
//dump("not static ptrlit", r);
|
||||
|
||||
case OSTRARRAYBYTE:
|
||||
case OSTR2BYTES:
|
||||
if l.Class() == PEXTERN && r.Left.Op == OLITERAL {
|
||||
sval := r.Left.Val().U.(string)
|
||||
slicebytes(l, sval, len(sval))
|
||||
|
|
@ -585,7 +585,7 @@ func (n *Node) isSimpleName() bool {
|
|||
|
||||
func litas(l *Node, r *Node, init *Nodes) {
|
||||
a := nod(OAS, l, r)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = walkexpr(a, init)
|
||||
init.Append(a)
|
||||
}
|
||||
|
|
@ -746,7 +746,7 @@ func fixedlit(ctxt initContext, kind initKind, n *Node, var_ *Node, init *Nodes)
|
|||
// build list of assignments: var[index] = expr
|
||||
setlineno(value)
|
||||
a = nod(OAS, a, value)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
switch kind {
|
||||
case initKindStatic:
|
||||
genAsStatic(a)
|
||||
|
|
@ -774,7 +774,7 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
|
|||
fixedlit(ctxt, initKindDynamic, n, vstat, init)
|
||||
|
||||
// copy static to slice
|
||||
var_ = typecheck(var_, Erv|Easgn)
|
||||
var_ = typecheck(var_, ctxExpr|ctxAssign)
|
||||
var nam Node
|
||||
if !stataddr(&nam, var_) || nam.Class() != PEXTERN {
|
||||
Fatalf("slicelit: %v", var_)
|
||||
|
|
@ -839,7 +839,7 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
|
|||
|
||||
if vstat == nil {
|
||||
a = nod(OAS, x, nil)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
init.Append(a) // zero new temp
|
||||
} else {
|
||||
// Declare that we're about to initialize all of x.
|
||||
|
|
@ -852,7 +852,7 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
|
|||
a = temp(t)
|
||||
if vstat == nil {
|
||||
a = nod(OAS, temp(t), nil)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
init.Append(a) // zero new temp
|
||||
a = a.Left
|
||||
} else {
|
||||
|
|
@ -866,16 +866,16 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
|
|||
}
|
||||
|
||||
a = nod(OAS, vauto, a)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = walkexpr(a, init)
|
||||
init.Append(a)
|
||||
|
||||
if vstat != nil {
|
||||
// copy static to heap (4)
|
||||
a = nod(OIND, vauto, nil)
|
||||
a = nod(ODEREF, vauto, nil)
|
||||
|
||||
a = nod(OAS, a, vstat)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = walkexpr(a, init)
|
||||
init.Append(a)
|
||||
}
|
||||
|
|
@ -910,7 +910,7 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
|
|||
setlineno(value)
|
||||
a = nod(OAS, a, value)
|
||||
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = orderStmtInPlace(a, map[string][]*Node{})
|
||||
a = walkstmt(a)
|
||||
init.Append(a)
|
||||
|
|
@ -919,7 +919,7 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
|
|||
// make slice out of heap (6)
|
||||
a = nod(OAS, var_, nod(OSLICE, vauto, nil))
|
||||
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = orderStmtInPlace(a, map[string][]*Node{})
|
||||
a = walkstmt(a)
|
||||
init.Append(a)
|
||||
|
|
@ -993,7 +993,7 @@ func maplit(n *Node, m *Node, init *Nodes) {
|
|||
loop.Nbody.Set1(body)
|
||||
loop.Ninit.Set1(zero)
|
||||
|
||||
loop = typecheck(loop, Etop)
|
||||
loop = typecheck(loop, ctxStmt)
|
||||
loop = walkstmt(loop)
|
||||
init.Append(loop)
|
||||
} else {
|
||||
|
|
@ -1023,19 +1023,19 @@ func addMapEntries(m *Node, dyn []*Node, init *Nodes) {
|
|||
|
||||
setlineno(index)
|
||||
a := nod(OAS, key, index)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = walkstmt(a)
|
||||
init.Append(a)
|
||||
|
||||
setlineno(value)
|
||||
a = nod(OAS, val, value)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = walkstmt(a)
|
||||
init.Append(a)
|
||||
|
||||
setlineno(val)
|
||||
a = nod(OAS, nod(OINDEX, m, key), val)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = walkstmt(a)
|
||||
init.Append(a)
|
||||
|
||||
|
|
@ -1045,10 +1045,10 @@ func addMapEntries(m *Node, dyn []*Node, init *Nodes) {
|
|||
}
|
||||
|
||||
a := nod(OVARKILL, key, nil)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
init.Append(a)
|
||||
a = nod(OVARKILL, val, nil)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
init.Append(a)
|
||||
}
|
||||
|
||||
|
|
@ -1068,7 +1068,7 @@ func anylit(n *Node, var_ *Node, init *Nodes) {
|
|||
// n.Right is stack temporary used as backing store.
|
||||
init.Append(nod(OAS, n.Right, nil)) // zero backing store, just in case (#18410)
|
||||
r = nod(OADDR, n.Right, nil)
|
||||
r = typecheck(r, Erv)
|
||||
r = typecheck(r, ctxExpr)
|
||||
} else {
|
||||
r = nod(ONEW, nil, nil)
|
||||
r.SetTypecheck(1)
|
||||
|
|
@ -1079,11 +1079,11 @@ func anylit(n *Node, var_ *Node, init *Nodes) {
|
|||
r = walkexpr(r, init)
|
||||
a := nod(OAS, var_, r)
|
||||
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
init.Append(a)
|
||||
|
||||
var_ = nod(OIND, var_, nil)
|
||||
var_ = typecheck(var_, Erv|Easgn)
|
||||
var_ = nod(ODEREF, var_, nil)
|
||||
var_ = typecheck(var_, ctxExpr|ctxAssign)
|
||||
anylit(n.Left, var_, init)
|
||||
|
||||
case OSTRUCTLIT, OARRAYLIT:
|
||||
|
|
@ -1105,7 +1105,7 @@ func anylit(n *Node, var_ *Node, init *Nodes) {
|
|||
// copy static to var
|
||||
a := nod(OAS, var_, vstat)
|
||||
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = walkexpr(a, init)
|
||||
init.Append(a)
|
||||
|
||||
|
|
@ -1123,7 +1123,7 @@ func anylit(n *Node, var_ *Node, init *Nodes) {
|
|||
// initialization of an array or struct with unspecified components (missing fields or arrays)
|
||||
if var_.isSimpleName() || int64(n.List.Len()) < components {
|
||||
a := nod(OAS, var_, nil)
|
||||
a = typecheck(a, Etop)
|
||||
a = typecheck(a, ctxStmt)
|
||||
a = walkexpr(a, init)
|
||||
init.Append(a)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue