parser/switch-statement.vala \
parser/switch-section-outside-switch.test \
parser/template.vala \
+ parser/try-catch-in-switch-case-invalid.test \
parser/tuple.vala \
parser/unsupported-property-async.test \
parser/unsupported-property-throws.test \
--- /dev/null
+Invalid Code
+
+void main () {
+ switch (42) {
+ case 42:
+ try {
+ GLib.print ("42");
+ catch (GLib.Error e) {
+ debug ("foo");
+ }
+ break;
+ default:
+ debug ("bar");
+ break;
+ }
+}
if (current () == TokenType.FINALLY) {
finally_clause = parse_finally_clause ();
}
- } else {
+ } else if (current () == TokenType.FINALLY) {
finally_clause = parse_finally_clause ();
+ } else {
+ report_parse_error (new ParseError.SYNTAX ("expected `catch' or `finally'"));
}
var stmt = new TryStatement (try_block, finally_clause, get_src (begin));
foreach (CatchClause clause in catch_clauses) {