summaryrefslogtreecommitdiff
path: root/src/PrintPure.ml
diff options
context:
space:
mode:
authorSon Ho2022-02-04 10:22:35 +0100
committerSon Ho2022-02-04 10:22:35 +0100
commit3c906b905e3ba957d193c168a6c84ece06136a1e (patch)
tree2e637a7e45176960d98e03584ac0096ae20a34d9 /src/PrintPure.ml
parente24b71934f7d1070caf7dbfd1bdaa31072b9b4aa (diff)
Merge the switches over integers and the matches over enumerations in
the pure AST
Diffstat (limited to 'src/PrintPure.ml')
-rw-r--r--src/PrintPure.ml15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/PrintPure.ml b/src/PrintPure.ml
index 0325e60c..81ebcc7e 100644
--- a/src/PrintPure.ml
+++ b/src/PrintPure.ml
@@ -267,6 +267,7 @@ let adt_g_value_to_string (fmt : value_formatter)
let rec typed_lvalue_to_string (fmt : value_formatter) (v : typed_lvalue) :
string =
match v.value with
+ | LvConcrete cv -> Print.Values.constant_value_to_string cv
| LvVar var -> var_or_dummy_to_string fmt var
| LvAdt av ->
adt_g_value_to_string fmt
@@ -415,20 +416,6 @@ and switch_to_string (fmt : ast_formatter) (indent : string)
let e_false = texpression_to_string fmt indent1 indent_incr e_false in
"if " ^ scrut ^ "\n" ^ indent ^ "then\n" ^ indent ^ e_true ^ "\n" ^ indent
^ "else\n" ^ indent ^ e_false
- | SwitchInt (_, branches, otherwise) ->
- let branches =
- List.map
- (fun (v, be) ->
- indent ^ "| " ^ scalar_value_to_string v ^ " ->\n" ^ indent1
- ^ texpression_to_string fmt indent1 indent_incr be)
- branches
- in
- let otherwise =
- indent ^ "| _ ->\n" ^ indent1
- ^ texpression_to_string fmt indent1 indent_incr otherwise
- in
- let all_branches = List.append branches [ otherwise ] in
- "switch " ^ scrut ^ " with\n" ^ String.concat "\n" all_branches
| Match branches ->
let val_fmt = ast_to_value_formatter fmt in
let branch_to_string (b : match_branch) : string =