diff --git a/src/cmd/compile/internal/types/etype_string.go b/src/cmd/compile/internal/types/etype_string.go new file mode 100644 index 00000000000..acb10119f4d --- /dev/null +++ b/src/cmd/compile/internal/types/etype_string.go @@ -0,0 +1,16 @@ +// Code generated by "stringer -type EType -trimprefix T"; DO NOT EDIT. + +package types + +import "fmt" + +const _EType_name = "xxxINT8UINT8INT16UINT16INT32UINT32INT64UINT64INTUINTUINTPTRCOMPLEX64COMPLEX128FLOAT32FLOAT64BOOLPTR32PTR64FUNCSLICEARRAYSTRUCTCHANMAPINTERFORWANYSTRINGUNSAFEPTRIDEALNILBLANKFUNCARGSCHANARGSDDDFIELDSSATUPLENTYPE" + +var _EType_index = [...]uint8{0, 3, 7, 12, 17, 23, 28, 34, 39, 45, 48, 52, 59, 68, 78, 85, 92, 96, 101, 106, 110, 115, 120, 126, 130, 133, 138, 142, 145, 151, 160, 165, 168, 173, 181, 189, 197, 200, 205, 210} + +func (i EType) String() string { + if i >= EType(len(_EType_index)-1) { + return fmt.Sprintf("EType(%d)", i) + } + return _EType_name[_EType_index[i]:_EType_index[i+1]] +} diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index 44cdabcb30d..e62d324cdee 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -15,11 +15,13 @@ import ( // TODO(gri) try to eliminate soon type Node struct{ _ int } +//go:generate stringer -type EType -trimprefix T + // EType describes a kind of type. type EType uint8 const ( - Txxx = iota + Txxx EType = iota TINT8 TUINT8 diff --git a/src/cmd/compile/internal/types/utils.go b/src/cmd/compile/internal/types/utils.go index 796cd449de4..0eac402f8e0 100644 --- a/src/cmd/compile/internal/types/utils.go +++ b/src/cmd/compile/internal/types/utils.go @@ -76,51 +76,3 @@ func (f *bitset8) set(mask uint8, b bool) { *(*uint8)(f) &^= mask } } - -var etnames = []string{ - Txxx: "Txxx", - TINT: "INT", - TUINT: "UINT", - TINT8: "INT8", - TUINT8: "UINT8", - TINT16: "INT16", - TUINT16: "UINT16", - TINT32: "INT32", - TUINT32: "UINT32", - TINT64: "INT64", - TUINT64: "UINT64", - TUINTPTR: "UINTPTR", - TFLOAT32: "FLOAT32", - TFLOAT64: "FLOAT64", - TCOMPLEX64: "COMPLEX64", - TCOMPLEX128: "COMPLEX128", - TBOOL: "BOOL", - TPTR32: "PTR32", - TPTR64: "PTR64", - TFUNC: "FUNC", - TARRAY: "ARRAY", - TSLICE: "SLICE", - TSTRUCT: "STRUCT", - TCHAN: "CHAN", - TMAP: "MAP", - TINTER: "INTER", - TFORW: "FORW", - TSTRING: "STRING", - TUNSAFEPTR: "TUNSAFEPTR", - TANY: "ANY", - TIDEAL: "TIDEAL", - TNIL: "TNIL", - TBLANK: "TBLANK", - TFUNCARGS: "TFUNCARGS", - TCHANARGS: "TCHANARGS", - TDDDFIELD: "TDDDFIELD", - TSSA: "TSSA", - TTUPLE: "TTUPLE", -} - -func (et EType) String() string { - if int(et) < len(etnames) && etnames[et] != "" { - return etnames[et] - } - return fmt.Sprintf("E-%d", et) -}