summaryrefslogtreecommitdiff
path: root/compiler/ExtractName.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--compiler/ExtractName.ml25
1 files changed, 9 insertions, 16 deletions
diff --git a/compiler/ExtractName.ml b/compiler/ExtractName.ml
index 4c1ffb46..b53f4cdd 100644
--- a/compiler/ExtractName.ml
+++ b/compiler/ExtractName.ml
@@ -31,8 +31,7 @@ end
For impl blocks, we simply use the name of the type (without its arguments)
if all the arguments are variables.
*)
-let pattern_to_extract_name (is_trait_impl : bool) (name : pattern) :
- string list =
+let pattern_to_extract_name (name : pattern) : string list =
let c = { tgt = TkName } in
let is_var (g : generic_arg) : bool =
match g with
@@ -68,32 +67,26 @@ let pattern_to_extract_name (is_trait_impl : bool) (name : pattern) :
expr_to_string c ty)
in
let rec pattern_to_string (n : pattern) : string list =
- match n with
- | [] -> raise (Failure "Unreachable")
- | [ e ] ->
- let e = elem_to_string e in
- if is_trait_impl then [ e ^ "Inst" ] else [ e ]
- | e :: n -> elem_to_string e :: pattern_to_string n
+ match n with [] -> [] | e :: n -> elem_to_string e :: pattern_to_string n
in
pattern_to_string name
-let pattern_to_type_extract_name = pattern_to_extract_name false
-let pattern_to_fun_extract_name = pattern_to_extract_name false
-let pattern_to_trait_impl_extract_name = pattern_to_extract_name true
+let pattern_to_type_extract_name = pattern_to_extract_name
+let pattern_to_fun_extract_name = pattern_to_extract_name
+let pattern_to_trait_impl_extract_name = pattern_to_extract_name
(* TODO: this is provisional. We just want to make sure that the extraction
names we derive from the patterns (for the builtin definitions) are
consistent with the extraction names we derive from the Rust names *)
-let name_to_simple_name (ctx : ctx) (is_trait_impl : bool) (n : Types.name) :
- string list =
+let name_to_simple_name (ctx : ctx) (n : Types.name) : string list =
let c : to_pat_config =
{ tgt = TkName; use_trait_decl_refs = match_with_trait_decl_refs }
in
- pattern_to_extract_name is_trait_impl (name_to_pattern ctx c n)
+ pattern_to_extract_name (name_to_pattern ctx c n)
(** If the [prefix] is Some, we attempt to remove the common prefix
between [prefix] and [name] from [name] *)
-let name_with_generics_to_simple_name (ctx : ctx) (is_trait_impl : bool)
+let name_with_generics_to_simple_name (ctx : ctx)
?(prefix : Types.name option = None) (name : Types.name)
(p : Types.generic_params) (g : Types.generic_args) : string list =
let c : to_pat_config =
@@ -111,4 +104,4 @@ let name_with_generics_to_simple_name (ctx : ctx) (is_trait_impl : bool)
let _, _, name = pattern_common_prefix { equiv = true } prefix name in
name
in
- pattern_to_extract_name is_trait_impl name
+ pattern_to_extract_name name