Can we fix the problem without introducing a new syntax error? I've tried to be ...
10 years, 3 months ago
(2014-01-07 02:00:13 UTC)
#6
Can we fix the problem without introducing a new syntax error?
I've tried to be as permissive as possible in the grammar so that errors can be
generated at higher levels in the compiler, where the errors can be better.
'syntax error near fallthrough' is not nearly as good as something like
'fallthrough statement out of place', which is what you get for most uses.
For example, in the production that does $$->op = OSWITCH you could add
$$->xoffset = block;, and then the same for the OXFALL creation. And then the
fallthrough check in swt.c would be if(last->op == OXFALL && last->xoffset ==
sw->xoffset+1) to make sure it is not inside a nested block.
https://codereview.appspot.com/14920053/diff/190001/src/cmd/gc/swt.c File src/cmd/gc/swt.c (right): https://codereview.appspot.com/14920053/diff/190001/src/cmd/gc/swt.c#newcode331 src/cmd/gc/swt.c:331: yyerror("cannot fallthrough a closing brace"); it may be a ...
10 years, 2 months ago
(2014-02-11 01:14:40 UTC)
#8
LGTM https://codereview.appspot.com/14920053/diff/200001/test/fixedbugs/issue6500.go File test/fixedbugs/issue6500.go (right): https://codereview.appspot.com/14920053/diff/200001/test/fixedbugs/issue6500.go#newcode3 test/fixedbugs/issue6500.go:3: // Copyright 2013 The Go Authors. All rights ...
10 years, 2 months ago
(2014-02-19 03:15:50 UTC)
#11
Issue 14920053: code review 14920053: cmd/gc: reject incorrect use of fallthrough.
(Closed)
Created 10 years, 6 months ago by remyoudompheng
Modified 10 years, 2 months ago
Reviewers:
Base URL:
Comments: 3