From: Matthew Dempsky Date: Mon, 20 Mar 2017 09:21:50 +0000 (-0700) Subject: cmd/compile/internal/gc: eliminate two uses of Type.Pos X-Git-Tag: go1.9beta1~1091 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=07af21308c88c754fa2cd69a6d34d2b40b40c191;p=gostls13.git cmd/compile/internal/gc: eliminate two uses of Type.Pos Instead we can use t.nod.Pos. Change-Id: I643ee3226e402e38d4c77e8f328cbe83e55eac5c Reviewed-on: https://go-review.googlesource.com/38309 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick Reviewed-by: Robert Griesemer --- diff --git a/src/cmd/compile/internal/gc/align.go b/src/cmd/compile/internal/gc/align.go index c31464272d..ee3c7aec7e 100644 --- a/src/cmd/compile/internal/gc/align.go +++ b/src/cmd/compile/internal/gc/align.go @@ -126,7 +126,7 @@ func dowidth(t *Type) { if t.Width == -2 { if !t.Broke() { t.SetBroke(true) - yyerrorl(t.Pos, "invalid recursive type %v", t) + yyerrorl(t.nod.Pos, "invalid recursive type %v", t) } t.Width = 0 @@ -143,7 +143,10 @@ func dowidth(t *Type) { defercalc++ lno := lineno - lineno = t.Pos + if t.nod != nil { + lineno = t.nod.Pos + } + t.Width = -2 t.Align = 0 diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 81880e0694..27b9bb7b5e 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -3822,6 +3822,7 @@ func typecheckdef(n *Node) *Node { } n.Walkdef = 1 n.Type = typ(TFORW) + n.Type.nod = n n.Type.Sym = n.Sym // TODO(gri) this also happens in typecheckdeftype(n) - where should it happen? nerrors0 := nerrors typecheckdeftype(n)