Skip to content

Commit

Permalink
cmd/compile: use embedlineno instead of lineno in copytype
Browse files Browse the repository at this point in the history
Also remove lineno from typecheckdeftype since copytype was
the only user of it and typecheck uses lineno independently.

toolstach-check passed.

Updates golang#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>
  • Loading branch information
Yury Smolsky authored and komuw committed Dec 4, 2018
1 parent ece91c4 commit 33ab41a
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/cmd/compile/internal/gc/typecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -3637,8 +3630,6 @@ func typecheckdeftype(n *Node) {
// that don't come along.
copytype(n, t)
}

lineno = lno
}

func typecheckdef(n *Node) {
Expand Down

0 comments on commit 33ab41a

Please sign in to comment.