mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
1821639b57
commit
6b309be7ab
3 changed files with 97 additions and 14 deletions
|
|
@ -162,7 +162,7 @@ func testSyntaxErrors(t *testing.T, filename string) {
|
|||
} else {
|
||||
t.Errorf("%s:%s: unexpected error: %s", filename, orig, e.Msg)
|
||||
}
|
||||
}, nil, 0)
|
||||
}, nil, CheckBranches)
|
||||
|
||||
if *print {
|
||||
fmt.Println()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue