Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[fix] qmlflat: pretending to compile throw and catch in non cps mode

  • Loading branch information...
commit b7cdc64fc3c28b824093b03a8ef7c11f8d5f3ab8 1 parent d00617e
Valentin Gatien-Baron authored
Showing with 4 additions and 1 deletion.
  1. +1 −1  qml2ocaml/qml2ocaml.ml
  2. +3 −0  qmlflat/flat/flat_ExprGeneration.ml
View
2  qml2ocaml/qml2ocaml.ml
@@ -140,7 +140,7 @@ let qml_to_ocaml_factory : ('a, 'b, 'c) back_end_factory -> qml_to_ocaml =
let used_bypasses =
let bypass_of_directive = function
| `assert_ -> Some "bslpervasives.assertion"
- | `fail -> Some "bslpervasives.fail"
+ | `fail | `throw | `catch -> Some "bslpervasives.fail"
| `callcc -> Some "bslcps.notcps_compatibility.callcc_directive"
| `thread_context -> Some "bslcps.notcps_compatibility.thread_context"
| `with_thread_context -> Some "bslcps.notcps_compatibility.with_thread_context"
View
3  qmlflat/flat/flat_ExprGeneration.ml
@@ -267,6 +267,9 @@ let expr env expr =
let exprs = List.tail_map aux exprs in
Ocaml.AnArray exprs
+ | Q.Directive (label, (`throw | `catch), _, _) when not env.E.options.Qml2ocamlOptions.cps ->
+ aux (Q.Directive (label, `fail, [QCons.string "Call to throw or catch in non cps mode"], []))
+
| Q.Directive (_, variant, exprs, tys) ->
env_expr_error env expr
"Internal error: At this stage, all directives %a should have been compiled"
Please sign in to comment.
Something went wrong with that request. Please try again.