cmd/compile: consolidate Type construction and copying code

This should is preparatory cleanup to make it easier to use separate
types to represent each kind of Go type, rather than a single omnibus
Type struct with heavily overloaded fields.

Also, add TODO comments marking assignments that change an existing
Type's kind, as they need to be removed before we can factor Type.

Change-Id: If4b551fdea4ae045b10b1a3de2ee98f5cf32a517
Reviewed-on: https://go-review.googlesource.com/20494
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Matthew Dempsky 2016-03-09 15:32:57 -08:00
parent c2400e31ad
commit b014b55b82
5 changed files with 39 additions and 35 deletions

View file

@ -697,8 +697,7 @@ func arraylit(ctxt int, pass int, n *Node, var_ *Node, init *Nodes) {
func slicelit(ctxt int, n *Node, var_ *Node, init *Nodes) {
// make an array type
t := shallow(n.Type)
t := n.Type.Copy()
t.Bound = Mpgetfix(n.Right.Val().U.(*Mpint))
t.Width = 0
t.Sym = nil