mirror of https://github.com/golang/go.git
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:
parent
e34f660a52
commit
34c58fe184
|
|
@ -3608,21 +3608,14 @@ func copytype(n *Node, t *types.Type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double-check use of type as embedded type.
|
// Double-check use of type as embedded type.
|
||||||
lno := lineno
|
|
||||||
|
|
||||||
if embedlineno.IsKnown() {
|
if embedlineno.IsKnown() {
|
||||||
lineno = embedlineno
|
|
||||||
if t.IsPtr() || t.IsUnsafePtr() {
|
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) {
|
func typecheckdeftype(n *Node) {
|
||||||
lno := lineno
|
|
||||||
setlineno(n)
|
|
||||||
n.Type.Sym = n.Sym
|
n.Type.Sym = n.Sym
|
||||||
n.SetTypecheck(1)
|
n.SetTypecheck(1)
|
||||||
n.Name.Param.Ntype = typecheck(n.Name.Param.Ntype, Etype)
|
n.Name.Param.Ntype = typecheck(n.Name.Param.Ntype, Etype)
|
||||||
|
|
@ -3637,8 +3630,6 @@ func typecheckdeftype(n *Node) {
|
||||||
// that don't come along.
|
// that don't come along.
|
||||||
copytype(n, t)
|
copytype(n, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
lineno = lno
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func typecheckdef(n *Node) {
|
func typecheckdef(n *Node) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue