Skip to content

Commit

Permalink
Rename variables def and ctx_map
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
  • Loading branch information
rgrinberg committed May 8, 2019
1 parent ebb319e commit 3083c7e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,9 @@ let separate_independant_contexts topo_contexts =
| (acc, cur) -> (List.rev cur) :: acc

let instantiate_context env (workspace : Workspace.t)
(def : Workspace.Context.t) ctx_map =
(context : Workspace.Context.t) contexts =
let env_nodes =
let context = Workspace.Context.env def in
let context = Workspace.Context.env context in
{ Env_nodes.
context
; workspace = workspace.env
Expand All @@ -622,14 +622,14 @@ let instantiate_context env (workspace : Workspace.t)
let host_context =
(* The fact that the context list in [Workspace.t] is
topologically sorted ensures that this [find_exn] won't fail *)
Workspace.Context.host_context def
|> Option.map ~f:(String.Map.find_exn ctx_map)
Workspace.Context.host_context context
|> Option.map ~f:(String.Map.find_exn contexts)
in
match def with
match context with
| Default { targets; name; host_context = _; profile; env = _
; toolchain ; loc = _ } ->
let merlin =
workspace.merlin_context = Some (Workspace.Context.name def)
workspace.merlin_context = Some (Workspace.Context.name context)
in
let host_toolchain =
match toolchain with
Expand All @@ -645,14 +645,14 @@ let instantiate_context env (workspace : Workspace.t)
~targets ~host_context ~host_toolchain:toolchain

let instantiate_context_group ~env (workspace : Workspace.t) contexts =
List.fold_left contexts ~f:(fun acc def ->
let* (ctx_map, contexts) = acc in
let+ new_contexts = instantiate_context env workspace def ctx_map in
List.fold_left contexts ~f:(fun acc context ->
let* (contexts, contexts) = acc in
let+ new_contexts = instantiate_context env workspace context contexts in
let updated_map =
List.fold_left
new_contexts
~f:(fun map elem -> String.Map.add map elem.name elem)
~init:ctx_map
~init:contexts
in
(updated_map, new_contexts @ contexts))
~init:(Fiber.return (String.Map.empty, []))
Expand Down

0 comments on commit 3083c7e

Please sign in to comment.