Use maps instead of hash tables for variable lookup
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
7b05fc34b6
commit
5f783be1b2
|
@ -122,7 +122,7 @@ end = struct
|
||||||
| Renamed_in of Syntax.Version.t * string
|
| Renamed_in of Syntax.Version.t * string
|
||||||
|
|
||||||
module Map = struct
|
module Map = struct
|
||||||
type nonrec 'a t = 'a t String.Table.t
|
type nonrec 'a t = 'a t String.Map.t
|
||||||
|
|
||||||
let values v = Nothing (Kind.Values v)
|
let values v = Nothing (Kind.Values v)
|
||||||
let renamed_in ~new_name ~version = Renamed_in (version, new_name)
|
let renamed_in ~new_name ~version = Renamed_in (version, new_name)
|
||||||
|
@ -161,7 +161,7 @@ end = struct
|
||||||
|
|
||||||
; "path-no-dep", deleted_in ~version:(1, 0) Path_no_dep
|
; "path-no-dep", deleted_in ~version:(1, 0) Path_no_dep
|
||||||
]
|
]
|
||||||
|> String.Table.of_list_exn
|
|> String.Map.of_list_exn
|
||||||
|
|
||||||
let create_vars ~(context : Context.t) ~cxx_flags =
|
let create_vars ~(context : Context.t) ~cxx_flags =
|
||||||
let ocamlopt =
|
let ocamlopt =
|
||||||
|
@ -226,13 +226,13 @@ end = struct
|
||||||
; vars
|
; vars
|
||||||
]
|
]
|
||||||
|> List.concat
|
|> List.concat
|
||||||
|> String.Table.of_list_exn
|
|> String.Map.of_list_exn
|
||||||
|
|
||||||
let static_vars = String.Table.of_list_exn static_vars
|
let static_vars = String.Map.of_list_exn static_vars
|
||||||
|
|
||||||
let rec expand t ~syntax_version ~var =
|
let rec expand t ~syntax_version ~var =
|
||||||
let name = String_with_vars.Var.name var in
|
let name = String_with_vars.Var.name var in
|
||||||
Option.bind (String.Table.find t name) ~f:(function
|
Option.bind (String.Map.find t name) ~f:(function
|
||||||
| Nothing v -> Some v
|
| Nothing v -> Some v
|
||||||
| Since (v, min_version) ->
|
| Since (v, min_version) ->
|
||||||
if syntax_version >= min_version then
|
if syntax_version >= min_version then
|
||||||
|
|
Loading…
Reference in New Issue