]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/syntax: check fallthrough in CheckBranches mode
authorRobert Griesemer <gri@golang.org>
Fri, 24 Jun 2022 22:55:30 +0000 (15:55 -0700)
committerRobert Griesemer <gri@golang.org>
Sun, 26 Jun 2022 00:21:29 +0000 (00:21 +0000)
commit6b309be7ab7c17beb77c6e40b258278e7454d919
tree3210248a9b11292976532e5f73697cf631e83779
parent1821639b57a643f9c3f6d3b3d329d2283d5d7a57
cmd/compile/internal/syntax: check fallthrough in CheckBranches mode

The parser CheckBranches mode checked correct use of break, continue,
and labels, but not of fallthrough statements.

This CL adds checking of fallthrough statements as well.

For #51456.

Change-Id: I5000388011973724f80c59a6aaf015e3bb70faea
Reviewed-on: https://go-review.googlesource.com/c/go/+/414134
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/cmd/compile/internal/syntax/branches.go
src/cmd/compile/internal/syntax/error_test.go
src/cmd/compile/internal/syntax/testdata/fallthrough.go [new file with mode: 0644]