Skip to content
Browse files

trim down some errors relating to incomplete control structures

  • Loading branch information...
1 parent 3c85b1b commit d467d079d96b313c17b37c639b0ded58df662181 @gavinking gavinking committed Feb 24, 2014
Showing with 17 additions and 16 deletions.
  1. +6 −6 Ceylon.g
  2. +9 −9 Ceylon.nodes
  3. +2 −1 src/com/redhat/ceylon/compiler/typechecker/analyzer/DeclarationVisitor.java
View
12 Ceylon.g
@@ -2979,8 +2979,8 @@ forBlock returns [ForClause clause]
failBlock returns [ElseClause clause]
: ELSE_CLAUSE
{ $clause = new ElseClause($ELSE_CLAUSE); }
- block
- { $clause.setBlock($block.block); }
+ controlBlock
+ { $clause.setBlock($controlBlock.block); }
;
forIterator returns [ForIterator iterator]
@@ -3068,8 +3068,8 @@ catchBlock returns [CatchClause clause]
{ $clause = new CatchClause($CATCH_CLAUSE); }
catchVariable
{ $clause.setCatchVariable($catchVariable.catchVariable); }
- block
- { $clause.setBlock($block.block); }
+ controlBlock
+ { $clause.setBlock($controlBlock.block); }
;
catchVariable returns [CatchVariable catchVariable]
@@ -3087,8 +3087,8 @@ catchVariable returns [CatchVariable catchVariable]
finallyBlock returns [FinallyClause clause]
: FINALLY_CLAUSE
{ $clause = new FinallyClause($FINALLY_CLAUSE); }
- block
- { $clause.setBlock($block.block); }
+ controlBlock
+ { $clause.setBlock($controlBlock.block); }
;
resources returns [ResourceList resources]
View
18 Ceylon.nodes
@@ -400,16 +400,16 @@
^(DYNAMIC_STATEMENT:CONTROL_STATEMENT
DYNAMIC_CLAUSE)
^(DYNAMIC_CLAUSE:CONTROL_CLAUSE
- BLOCK)
+ BLOCK?)
^(IF_STATEMENT:CONTROL_STATEMENT
IF_CLAUSE
ELSE_CLAUSE?)
^(IF_CLAUSE:CONTROL_CLAUSE
CONDITION_LIST
- BLOCK)
+ BLOCK?)
^(ELSE_CLAUSE:CONTROL_CLAUSE
- BLOCK)
+ BLOCK?)
^(SWITCH_STATEMENT:CONTROL_STATEMENT
SWITCH_CLAUSE
@@ -421,7 +421,7 @@
ELSE_CLAUSE?)
^(CASE_CLAUSE:CONTROL_CLAUSE
CASE_ITEM
- BLOCK)
+ BLOCK?)
^(CASE_ITEM)
^(MATCH_CASE:CASE_ITEM
@@ -438,12 +438,12 @@
FINALLY_CLAUSE?)
^(TRY_CLAUSE:CONTROL_CLAUSE
RESOURCE_LIST?
- BLOCK)
+ BLOCK?)
^(CATCH_CLAUSE:CONTROL_CLAUSE
CATCH_VARIABLE
- BLOCK)
+ BLOCK?)
^(FINALLY_CLAUSE:CONTROL_CLAUSE
- BLOCK)
+ BLOCK?)
^(RESOURCE_LIST
RESOURCE*)
^(RESOURCE
@@ -457,7 +457,7 @@
boolean exits;)
^(FOR_CLAUSE:CONTROL_CLAUSE
FOR_ITERATOR
- BLOCK)
+ BLOCK?)
^(FOR_ITERATOR:STATEMENT_OR_ARGUMENT
SPECIFIER_EXPRESSION)
^(VALUE_ITERATOR:FOR_ITERATOR
@@ -470,7 +470,7 @@
WHILE_CLAUSE)
^(WHILE_CLAUSE:CONTROL_CLAUSE
CONDITION_LIST
- BLOCK)
+ BLOCK?)
^(CONDITION_LIST
CONDITION*)
View
3 src/com/redhat/ceylon/compiler/typechecker/analyzer/DeclarationVisitor.java
@@ -1275,7 +1275,8 @@ private void checkPositionalArguments(List<Tree.PositionalArgument> args) {
@Override
public void visit(Tree.TryCatchStatement that) {
super.visit(that);
- if (that.getCatchClauses().isEmpty() &&
+ if (that.getTryClause().getBlock()!=null &&
+ that.getCatchClauses().isEmpty() &&
that.getFinallyClause()==null &&
that.getTryClause().getResourceList()==null) {
that.addError("try must have a catch, finally, or resource expression");

0 comments on commit d467d07

Please sign in to comment.
Something went wrong with that request. Please try again.