summaryrefslogtreecommitdiff
path: root/libgo/go/go/types/return.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/go/types/return.go')
-rw-r--r--libgo/go/go/types/return.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/libgo/go/go/types/return.go b/libgo/go/go/types/return.go
index 66289852147..0c1447f89b3 100644
--- a/libgo/go/go/types/return.go
+++ b/libgo/go/go/types/return.go
@@ -83,8 +83,13 @@ func (check *Checker) isTerminating(s ast.Stmt, label string) bool {
}
func (check *Checker) isTerminatingList(list []ast.Stmt, label string) bool {
- n := len(list)
- return n > 0 && check.isTerminating(list[n-1], label)
+ // trailing empty statements are permitted - skip them
+ for i := len(list) - 1; i >= 0; i-- {
+ if _, ok := list[i].(*ast.EmptyStmt); !ok {
+ return check.isTerminating(list[i], label)
+ }
+ }
+ return false // all statements are empty
}
func (check *Checker) isTerminatingSwitch(body *ast.BlockStmt, label string) bool {