Commit 3d7abc02 authored by POTTIER Francois's avatar POTTIER Francois

Move [etuple] and [ptuple] from [CodeBackend] to [CodeBits].

parent 1a96b802
......@@ -295,22 +295,6 @@ let assertnoerror : pattern * expr =
PUnit,
EApp (EVar "assert", [ EApp (EVar "not", [ ERecordAccess (EVar env, ferror) ]) ])
let etuple = function
| [] ->
assert false
| [ e ] ->
e
| es ->
ETuple es
let ptuple = function
| [] ->
assert false
| [ p ] ->
p
| ps ->
PTuple ps
let trace (format : string) (args : expr list) : (pattern * expr) list =
if Settings.trace then
[ PUnit, EApp (EVar "Printf.fprintf", (EVar "stderr") :: (EStringConst (format ^"\n%!")) :: args) ]
......
......@@ -16,6 +16,24 @@
open IL
(* Tuples. *)
let etuple = function
| [] ->
EUnit
| [ e ] ->
e
| es ->
ETuple es
let ptuple = function
| [] ->
PUnit
| [ p ] ->
p
| ps ->
PTuple ps
(* A list subject to a condition. *)
let listif condition xs =
......
......@@ -16,6 +16,11 @@
open IL
(* Tuples. *)
val etuple: expr list -> expr
val ptuple: pattern list -> pattern
(* A list subject to a condition. (Be careful, though: the list is
of course constructed even if the condition is false.) *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment