Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
fix spans for if expressions, fixing IDE bugs #3609
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Nov 14, 2014
1 parent 95b60e0 commit 0b0194b
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions typechecker/Ceylon.g
Original file line number Diff line number Diff line change
Expand Up @@ -2091,26 +2091,33 @@ defaultCaseExpression returns [ElseClause clause]
ifExpression returns [IfExpression term]
: IF_CLAUSE
{ $term = new IfExpression(null);
IfClause ic = new IfClause($IF_CLAUSE);
ElseClause ec = new ElseClause(null);
$term.setIfClause(ic);
$term.setElseClause(ec); }
conditions
{ $term.getIfClause().setConditionList($conditions.conditionList); }
{ $term = new IfExpression($IF_CLAUSE); }
thenElseClauses
{ $term.setIfClause($thenElseClauses.ifClause);
$term.setElseClause($thenElseClauses.elseClause);
if ($thenElseClauses.ifClause==null && $thenElseClauses.conditionList!=null)
$term.setIfClause(new IfClause(null));
$term.getIfClause().setConditionList($thenElseClauses.conditionList); }
;
thenElseClauses returns [IfClause ifClause, ElseClause elseClause, ConditionList conditionList]
: conditions
{ $conditionList = $conditions.conditionList; }
(
THEN_CLAUSE
{ $ifClause = new IfClause($THEN_CLAUSE); }
de1=disjunctionExpression
{ Expression e = new Expression($THEN_CLAUSE);
{ Expression e = new Expression(null);
e.setTerm($de1.term);
$term.getIfClause().setExpression(e); }
$ifClause.setExpression(e); }
)?
(
ELSE_CLAUSE
{ $elseClause = new ElseClause($ELSE_CLAUSE); }
de2=disjunctionExpression
{ Expression e = new Expression($ELSE_CLAUSE);
{ Expression e = new Expression(null);
e.setTerm($de2.term);
$term.getElseClause().setExpression(e); }
$elseClause.setExpression(e); }
)?
;
Expand Down

0 comments on commit 0b0194b

Please sign in to comment.