mirror of
https://github.com/golang/go
synced 2024-10-02 22:25:08 +00:00
[dev.regabi] cmd/compile: remove some unneeded code in package ir
The deepCopy functions haven't been needed since we switched to using Edit everywhere, and AddStringExpr no longer has an Alloc field that needs special casing. Passes toolstash -cmp. Change-Id: I5bcc8c73d5cb784f7e57fb3162ae6e288e6c9392 Reviewed-on: https://go-review.googlesource.com/c/go/+/280445 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
3bdafb0d82
commit
5f3bd59a0d
|
@ -169,10 +169,6 @@ func forNodeFields(typName string, typ *types.Struct, f func(name string, is fun
|
|||
case "orig":
|
||||
continue
|
||||
}
|
||||
switch typName + "." + v.Name() {
|
||||
case "AddStringExpr.Alloc":
|
||||
continue
|
||||
}
|
||||
f(v.Name(), func(t types.Type) bool { return types.Identical(t, v.Type()) })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,14 +115,6 @@ func (n *StructType) SetOTYPE(t *types.Type) {
|
|||
n.Fields = nil
|
||||
}
|
||||
|
||||
func deepCopyFields(pos src.XPos, fields []*Field) []*Field {
|
||||
var out []*Field
|
||||
for _, f := range fields {
|
||||
out = append(out, f.deepCopy(pos))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// An InterfaceType represents a struct { ... } type syntax.
|
||||
type InterfaceType struct {
|
||||
miniType
|
||||
|
@ -250,26 +242,6 @@ func editFields(list []*Field, edit func(Node) Node) {
|
|||
}
|
||||
}
|
||||
|
||||
func (f *Field) deepCopy(pos src.XPos) *Field {
|
||||
if f == nil {
|
||||
return nil
|
||||
}
|
||||
fpos := pos
|
||||
if !pos.IsKnown() {
|
||||
fpos = f.Pos
|
||||
}
|
||||
decl := f.Decl
|
||||
if decl != nil {
|
||||
decl = DeepCopy(pos, decl).(*Name)
|
||||
}
|
||||
ntype := f.Ntype
|
||||
if ntype != nil {
|
||||
ntype = DeepCopy(pos, ntype).(Ntype)
|
||||
}
|
||||
// No keyed literal here: if a new struct field is added, we want this to stop compiling.
|
||||
return &Field{fpos, f.Sym, ntype, f.Type, f.Embedded, f.IsDDD, f.Note, decl}
|
||||
}
|
||||
|
||||
// A SliceType represents a []Elem type syntax.
|
||||
// If DDD is true, it's the ...Elem at the end of a function list.
|
||||
type SliceType struct {
|
||||
|
|
Loading…
Reference in a new issue