Skip to main content
Sign in
Snippets Groups Projects
Commit 780895af authored by nilfit's avatar nilfit
Browse files

remove option from Econst string option

There is no case that leads to None
parent 8b8b8663
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@ module Rust = struct
type fn = rsymbol * var list * ty * expr * Stv.t * Slt.t
and expr =
| Econst of string option * BigInt.t
| Econst of string * BigInt.t
| Evar of ident
| Efield of expr * ident
| Eassign of pvsymbol * rsymbol * expr
......@@ -322,8 +322,7 @@ module Translate = struct
| I { ity_node = Ityapp ({its_ts = ts},_,_) } -> ts.ts_name
| _ -> assert false in
(match query_syntax info.literal id with
| Some s -> Rust.Econst (Some s, n)
(* TODO there can never be an Econst (None, ..), the option is not needed *)
| Some s -> Rust.Econst (s, n)
| None -> raise (MissingSyntaxLiteral id.id_string))
(* there is no default, driver must make a decision about how to represent
literals *)
......@@ -949,10 +948,7 @@ module Print = struct
let rec print_expr info fmt (e:expr) =
match e with
| Econst (s_opt, n) ->
(match s_opt with
| Some s -> syntax_arguments s print_constant fmt [n]
| None -> raise (TODO "const no syntax"))
| Econst (s, n) -> syntax_arguments s print_constant fmt [n]
| Evar id -> print_lident info fmt id
| Efield (e, id) ->
fprintf fmt "%a.%a" (print_expr info) e (print_lident info) id
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment