go.tools/go/types: (panic(0)) (parenthesized) is a terminating statement
R=adonovan CC=golang-dev https://golang.org/cl/13913043
This commit is contained in:
parent
9d1c551b43
commit
a6c151c04d
|
@ -28,8 +28,8 @@ func (check *checker) isTerminating(s ast.Stmt, label string) bool {
|
||||||
return check.isTerminating(s.Stmt, s.Label.Name)
|
return check.isTerminating(s.Stmt, s.Label.Name)
|
||||||
|
|
||||||
case *ast.ExprStmt:
|
case *ast.ExprStmt:
|
||||||
// the predeclared panic() function is terminating
|
// the predeclared (possibly parenthesized) panic() function is terminating
|
||||||
if call, _ := s.X.(*ast.CallExpr); call != nil {
|
if call, _ := unparen(s.X).(*ast.CallExpr); call != nil {
|
||||||
if id, _ := call.Fun.(*ast.Ident); id != nil {
|
if id, _ := call.Fun.(*ast.Ident); id != nil {
|
||||||
if obj := check.topScope.LookupParent(id.Name); obj != nil {
|
if obj := check.topScope.LookupParent(id.Name); obj != nil {
|
||||||
if b, _ := obj.(*Builtin); b != nil && b.id == _Panic {
|
if b, _ := obj.(*Builtin); b != nil && b.id == _Panic {
|
||||||
|
|
|
@ -11,6 +11,7 @@ func _() {}
|
||||||
func _() int {} /* ERROR "missing return" */
|
func _() int {} /* ERROR "missing return" */
|
||||||
|
|
||||||
func _() int { panic(0) }
|
func _() int { panic(0) }
|
||||||
|
func _() int { (panic(0)) }
|
||||||
|
|
||||||
// block statements
|
// block statements
|
||||||
func _(x, y int) (z int) {
|
func _(x, y int) (z int) {
|
||||||
|
|
Loading…
Reference in New Issue