1
0
mirror of https://github.com/golang/go synced 2024-11-13 19:10:22 -07:00

cmd/compile: use embedlineno instead of lineno in copytype

Also remove lineno from typecheckdeftype since copytype was
the only user of it and typecheck uses lineno independently.

toolstach-check passed.

Updates #19683.

Change-Id: I1663fdb8cf519d505cc087c8657dcbff3c8b1a0a
Reviewed-on: https://go-review.googlesource.com/114875
Run-TryBot: Yury Smolsky <yury@smolsky.by>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Yury Smolsky 2018-05-28 13:20:45 +03:00 committed by Robert Griesemer
parent e34f660a52
commit 34c58fe184

View File

@ -3608,21 +3608,14 @@ func copytype(n *Node, t *types.Type) {
}
// Double-check use of type as embedded type.
lno := lineno
if embedlineno.IsKnown() {
lineno = embedlineno
if t.IsPtr() || t.IsUnsafePtr() {
yyerror("embedded type cannot be a pointer")
yyerrorl(embedlineno, "embedded type cannot be a pointer")
}
}
lineno = lno
}
func typecheckdeftype(n *Node) {
lno := lineno
setlineno(n)
n.Type.Sym = n.Sym
n.SetTypecheck(1)
n.Name.Param.Ntype = typecheck(n.Name.Param.Ntype, Etype)
@ -3637,8 +3630,6 @@ func typecheckdeftype(n *Node) {
// that don't come along.
copytype(n, t)
}
lineno = lno
}
func typecheckdef(n *Node) {