Skip to content

Commit

Permalink
[parser] allow try without catch again and wave it trough in the …
Browse files Browse the repository at this point in the history
…typer
  • Loading branch information
Simn committed Dec 21, 2014
1 parent b84ca37 commit 740b2ed
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 11 deletions.
5 changes: 1 addition & 4 deletions parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1221,10 +1221,7 @@ and expr = parser
Display e -> display (EWhile (cond,e,NormalWhile),punion p1 (pos e)))
| [< '(Kwd Do,p1); e = expr; '(Kwd While,_); '(POpen,_); cond = expr; '(PClose,_); s >] -> (EWhile (cond,e,DoWhile),punion p1 (pos e))
| [< '(Kwd Switch,p1); e = expr; '(BrOpen,_); cases , def = parse_switch_cases e []; '(BrClose,p2); s >] -> (ESwitch (e,cases,def),punion p1 p2)
| [< '(Kwd Try,p1); e = expr; cl = plist (parse_catch e); >] ->
(match cl with
| [] -> error (Custom "Expected catch after try") p1
| _ -> (ETry (e,cl),p1))
| [< '(Kwd Try,p1); e = expr; cl = plist (parse_catch e); >] -> (ETry (e,cl),p1)
| [< '(IntInterval i,p1); e2 = expr >] -> make_binop OpInterval (EConst (Int i),p1) e2
| [< '(Kwd Untyped,p1); e = expr >] -> (EUntyped e,punion p1 (pos e))
| [< '(Dollar v,p); s >] -> expr_next (EConst (Ident ("$"^v)),p) s
Expand Down
5 changes: 0 additions & 5 deletions tests/misc/projects/Issue3699/MainTry.hx

This file was deleted.

1 change: 0 additions & 1 deletion tests/misc/projects/Issue3699/compile-try-fail.hxml

This file was deleted.

1 change: 0 additions & 1 deletion tests/misc/projects/Issue3699/compile-try-fail.hxml.stderr

This file was deleted.

2 changes: 2 additions & 0 deletions typer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3171,6 +3171,8 @@ and type_expr ctx (e,p) (with_type:with_type) =
| EContinue ->
if not ctx.in_loop then display_error ctx "Continue outside loop" p;
mk TContinue t_dynamic p
| ETry (e1,[]) ->
type_expr ctx e1 with_type
| ETry (e1,catches) ->
let e1 = type_expr ctx e1 with_type in
let rec check_unreachable cases t p = match cases with
Expand Down

0 comments on commit 740b2ed

Please sign in to comment.