diff options
author | Robert Griesemer <gri@golang.org> | 2013-03-01 16:45:14 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2013-03-01 16:45:14 -0800 |
commit | ba6cf902b1f6b0cd1d54acf21c2a5e053fc4d31d (patch) | |
tree | 90839f5094c9f3fb0a2f5b2d17e63dcbbb0d3715 /doc/go_spec.html | |
parent | f16f0bd84bfa590f49173571764c6e2db1ad02bc (diff) | |
download | go-ba6cf902b1f6b0cd1d54acf21c2a5e053fc4d31d.tar.gz |
spec: fallthrough may not appear in last clause of a switch
Replacement for CL 7370053 which attempted to make fallthrough's
syntactically a part of switch statements. Because they may be
labeled, fixing that CL completely would require too much spec
surgery.
Fixes issue 4923.
R=r, iant, rsc, ken
CC=golang-dev
https://codereview.appspot.com/7416048
Diffstat (limited to 'doc/go_spec.html')
-rw-r--r-- | doc/go_spec.html | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html index c5611cb1f..0cb9f54b1 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ <!--{ "Title": "The Go Programming Language Specification", - "Subtitle": "Version of February 11, 2013", + "Subtitle": "Version of March 1, 2013", "Path": "/ref/spec" }--> @@ -4154,12 +4154,14 @@ ExprSwitchCase = "case" ExpressionList | "default" . </pre> <p> -In a case or default clause, -the last statement only may be a "fallthrough" statement -(§<a href="#Fallthrough_statements">Fallthrough statement</a>) to +In a case or default clause, the last non-empty statement +may be a (possibly <a href="#Labeled_statements">labeled</a>) +<a href="#Fallthrough_statements">"fallthrough" statement</a> to indicate that control should flow from the end of this clause to the first statement of the next clause. Otherwise control flows to the end of the "switch" statement. +A "fallthrough" statement may appear as the last statement of all +but the last clause of an expression switch. </p> <p> @@ -4798,9 +4800,8 @@ the "for" statement's block but the <code>goto</code> is not. <p> A "fallthrough" statement transfers control to the first statement of the -next case clause in a expression "switch" statement (§<a href="#Expression_switches">Expression switches</a>). It may -be used only as the final non-empty statement in a case or default clause in an -expression "switch" statement. +next case clause in a <a href="#Expression_switches">expression "switch" statement</a>. +It may be used only as the final non-empty statement in such a clause. </p> <pre class="ebnf"> |