Use maps instead of hash tables for variable lookup

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-07-08 14:37:49 +07:00
parent 7b05fc34b6
commit 5f783be1b2
1 changed files with 5 additions and 5 deletions

View File

@ -122,7 +122,7 @@ end = struct
| Renamed_in of Syntax.Version.t * string
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 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
]
|> String.Table.of_list_exn
|> String.Map.of_list_exn
let create_vars ~(context : Context.t) ~cxx_flags =
let ocamlopt =
@ -226,13 +226,13 @@ end = struct
; vars
]
|> 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 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
| Since (v, min_version) ->
if syntax_version >= min_version then