mirror of
https://github.com/golang/go
synced 2024-09-30 11:18:33 -06:00
Revert "cmd/compile: strengthen SetFields/Width safety guarantee"
This reverts commit b1b4f67169
.
Reason for revert: Broke the build.
Change-Id: I5c99779896e39137c93c77d016ce683c872a69d7
Reviewed-on: https://go-review.googlesource.com/38532
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
b1b4f67169
commit
536a2257fb
@ -362,6 +362,10 @@ func transformclosure(xfunc *Node) {
|
||||
xfunc.Func.Dcl = append(decls, xfunc.Func.Dcl...)
|
||||
}
|
||||
|
||||
// Recalculate param offsets.
|
||||
if f.Type.Width > 0 {
|
||||
Fatalf("transformclosure: width is already calculated")
|
||||
}
|
||||
dowidth(f.Type)
|
||||
xfunc.Type = f.Type // update type of ODCLFUNC
|
||||
} else {
|
||||
|
@ -864,15 +864,6 @@ func (t *Type) FieldSlice() []*Field {
|
||||
|
||||
// SetFields sets struct/interface type t's fields/methods to fields.
|
||||
func (t *Type) SetFields(fields []*Field) {
|
||||
// If we've calculated the width of t before,
|
||||
// then some other type such as a function signature
|
||||
// might now have the wrong type.
|
||||
// Rather than try to track and invalidate those,
|
||||
// enforce that SetFields cannot be called once
|
||||
// t's width has been calculated.
|
||||
if t.WidthCalculated() {
|
||||
Fatalf("SetFields of %v: width previously calculated", t)
|
||||
}
|
||||
t.wantEtype(TSTRUCT)
|
||||
for _, f := range fields {
|
||||
// If type T contains a field F with a go:notinheap
|
||||
|
Loading…
Reference in New Issue
Block a user