mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: remove 'ext' fields from unified IR reader/writer types
This is a vestigial artifact of how I initially split apart the public and private data for objects. But now objects are split into more parts, and it's proven easier to just keep them as separate variables. So it's time to cleanup the initial public/private code to follow the same approach. Change-Id: I3976b19fb433cbe21d299d3799ec616f9e59561e Reviewed-on: https://go-review.googlesource.com/c/go/+/348412 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
parent
4c52eac49b
commit
42563f89d7
3 changed files with 20 additions and 32 deletions
|
|
@ -79,8 +79,6 @@ type reader struct {
|
|||
|
||||
p *pkgReader
|
||||
|
||||
ext *reader
|
||||
|
||||
dict *readerDict
|
||||
|
||||
// TODO(mdempsky): The state below is all specific to reading
|
||||
|
|
@ -586,10 +584,10 @@ func (pr *pkgReader) objIdx(idx int, implicits, explicits []*types.Type) ir.Node
|
|||
dict := pr.objDictIdx(sym, idx, implicits, explicits)
|
||||
|
||||
r := pr.newReader(relocObj, idx, syncObject1)
|
||||
r.ext = pr.newReader(relocObjExt, idx, syncObject1)
|
||||
rext := pr.newReader(relocObjExt, idx, syncObject1)
|
||||
|
||||
r.dict = dict
|
||||
r.ext.dict = dict
|
||||
rext.dict = dict
|
||||
|
||||
sym = r.mangle(sym)
|
||||
if !sym.IsBlank() && sym.Def != nil {
|
||||
|
|
@ -642,7 +640,7 @@ func (pr *pkgReader) objIdx(idx int, implicits, explicits []*types.Type) ir.Node
|
|||
name.Func = ir.NewFunc(r.pos())
|
||||
name.Func.Nname = name
|
||||
|
||||
r.ext.funcExt(name)
|
||||
rext.funcExt(name)
|
||||
return name
|
||||
|
||||
case objType:
|
||||
|
|
@ -651,7 +649,7 @@ func (pr *pkgReader) objIdx(idx int, implicits, explicits []*types.Type) ir.Node
|
|||
setType(name, typ)
|
||||
|
||||
// Important: We need to do this before SetUnderlying.
|
||||
r.ext.typeExt(name)
|
||||
rext.typeExt(name)
|
||||
|
||||
// We need to defer CheckSize until we've called SetUnderlying to
|
||||
// handle recursive types.
|
||||
|
|
@ -661,7 +659,7 @@ func (pr *pkgReader) objIdx(idx int, implicits, explicits []*types.Type) ir.Node
|
|||
|
||||
methods := make([]*types.Field, r.len())
|
||||
for i := range methods {
|
||||
methods[i] = r.method()
|
||||
methods[i] = r.method(rext)
|
||||
}
|
||||
if len(methods) != 0 {
|
||||
typ.Methods().Set(methods)
|
||||
|
|
@ -674,7 +672,7 @@ func (pr *pkgReader) objIdx(idx int, implicits, explicits []*types.Type) ir.Node
|
|||
case objVar:
|
||||
name := do(ir.ONAME, false)
|
||||
setType(name, r.typ())
|
||||
r.ext.varExt(name)
|
||||
rext.varExt(name)
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
|
@ -756,7 +754,7 @@ func (r *reader) typeParamNames() {
|
|||
}
|
||||
}
|
||||
|
||||
func (r *reader) method() *types.Field {
|
||||
func (r *reader) method(rext *reader) *types.Field {
|
||||
r.sync(syncMethod)
|
||||
pos := r.pos()
|
||||
pkg, sym := r.selector()
|
||||
|
|
@ -772,7 +770,7 @@ func (r *reader) method() *types.Field {
|
|||
name.Func = ir.NewFunc(r.pos())
|
||||
name.Func.Nname = name
|
||||
|
||||
r.ext.funcExt(name)
|
||||
rext.funcExt(name)
|
||||
|
||||
meth := types.NewField(name.Func.Pos(), sym, typ)
|
||||
meth.Nname = name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue