Browse files

[fix] compiler, parser: prevent empty letin

  • Loading branch information...
1 parent 0e06f6e commit b4e986a20d08d8a489d052691d5c12851fec787c @BourgerieQuentin BourgerieQuentin committed Feb 22, 2012
Showing with 9 additions and 5 deletions.
  1. +9 −5 opalang/classic_syntax/parser_utils.ml
View
14 opalang/classic_syntax/parser_utils.ml
@@ -1450,11 +1450,15 @@ let rewrite_add_recval x =
in aux x
let rewrite_letin is_rec binds expr =
- let binds =
- if is_rec then
- List.map (function (i, e) -> (i, rewrite_add_recval e)) binds
- else binds in
- LetIn (is_rec, binds, expr)
+ match binds with
+ | [] -> undecorate expr
+ | _ ->
+ let binds =
+ if is_rec then
+ List.map (function (i, e) -> (i, rewrite_add_recval e)) binds
+ else binds in
+ LetIn (is_rec, binds, expr)
+
let rewrite_long_extend_record fields expr =
let trees = make_record_tree fields in

0 comments on commit b4e986a

Please sign in to comment.