Jonathan Graveline pushed to branch graveline at Stefan / Typer
Commits: 1c406196 by Jonathan Graveline at 2018-06-14T02:26:12Z Added Vref as a value_type - - - - -
1 changed file:
- src/env.ml
Changes:
===================================== src/env.ml ===================================== --- a/src/env.ml +++ b/src/env.ml @@ -62,6 +62,7 @@ type value_type = | Vin of in_channel | Vout of out_channel | Vcommand of (unit -> value_type) + | Vref of (value_type ref)
(* Runtime Environ *) and runtime_env = (string option * (value_type ref)) M.myers @@ -90,6 +91,8 @@ let rec value_equal a b = (fun a b -> not (value_equal a b)) a1 a2)
+ | Vref (v1), Vref (v2) -> value_equal (!v1) (!v2) + | _ -> false
let rec value_eq_list a b = @@ -105,7 +108,7 @@ let value_location (vtp: value_type) = (* location info was lost or never existed *) | _ -> dloc
-let value_name v = +let rec value_name v = match v with | Vin _ -> "Vin" | Vout _ -> "Vout" @@ -120,6 +123,7 @@ let value_name v = | Closure _ -> "Closure" | Vbuiltin _ -> "Vbuiltin" | Vcommand _ -> "Vcommand" + | Vref v -> ("Vref of "^(value_name (!v)))
let rec value_string v = match v with @@ -140,6 +144,7 @@ let rec value_string v = (fun str v -> str ^ " " ^ value_string v) "" lst in "(" ^ s ^ args ^ ")" + | Vref (v) -> ("Ref of "^(value_string (!v)))
let value_print (vtp: value_type) = print_string (value_string vtp)
View it on GitLab: https://gitlab.com/monnier/typer/commit/1c4061966f9284728c4dd65aaa9686dc49a0...
Afficher les réponses par date