mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile/internal/syntax: cleanup panic calls
End-users are not expected to deal with the details of panics, so providing extra information such as an "internal error" prefix is not helpful. Matches the types2 changes made in https://golang.org/cl/339969 . Change-Id: Icb34a9daab981a84f41f8ae7ae5dc1b85b2d2c81 Reviewed-on: https://go-review.googlesource.com/c/go/+/339904 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
c3b57af8bc
commit
3a9fd99849
3 changed files with 4 additions and 4 deletions
|
|
@ -604,7 +604,7 @@ func (p *parser) typeDecl(group *Group) Decl {
|
||||||
} else {
|
} else {
|
||||||
// x is the array length expression
|
// x is the array length expression
|
||||||
if debug && x == nil {
|
if debug && x == nil {
|
||||||
panic("internal error: nil expression")
|
panic("length expression is nil")
|
||||||
}
|
}
|
||||||
d.Type = p.arrayType(pos, x)
|
d.Type = p.arrayType(pos, x)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ func StartPos(n Node) Pos {
|
||||||
for m := n; ; {
|
for m := n; ; {
|
||||||
switch n := m.(type) {
|
switch n := m.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
panic("internal error: nil")
|
panic("nil node")
|
||||||
|
|
||||||
// packages
|
// packages
|
||||||
case *File:
|
case *File:
|
||||||
|
|
@ -124,7 +124,7 @@ func EndPos(n Node) Pos {
|
||||||
for m := n; ; {
|
for m := n; ; {
|
||||||
switch n := m.(type) {
|
switch n := m.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
panic("internal error: nil")
|
panic("nil node")
|
||||||
|
|
||||||
// packages
|
// packages
|
||||||
case *File:
|
case *File:
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ type walker struct {
|
||||||
|
|
||||||
func (w walker) node(n Node) {
|
func (w walker) node(n Node) {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
panic("invalid syntax tree: nil node")
|
panic("nil node")
|
||||||
}
|
}
|
||||||
|
|
||||||
w.v = w.v.Visit(n)
|
w.v = w.v.Visit(n)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue