Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add find_depth_variable to Typing_env #450

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add find_depth_variable to Typing_env
  • Loading branch information
lukemaurer committed May 19, 2021
commit d74879e23e9db82509801d658a8195f6f133e1c0
11 changes: 11 additions & 0 deletions middle_end/flambda/types/env/typing_env.rec.ml
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,17 @@ let mem_depth_variable ?min_name_mode t dv =
~find:(fun dv t -> Depth_variable.Map.find dv (depth_variables t))
~in_imported_names:(fun _ _ -> false)

let find_depth_variable t dv =
let value, _binding_time, _name_mode =
Depth_variable.Map.find dv (depth_variables t)
in
value

let find_depth_variable_or_missing t dv =
match find_depth_variable t dv with
| exception Not_found -> None
| value -> Some value

let add_definition t (name : Name_in_binding_pos.t) kind =
let name_mode = Name_in_binding_pos.name_mode name in
Name.pattern_match (Name_in_binding_pos.name name)
Expand Down
7 changes: 7 additions & 0 deletions middle_end/flambda/types/env/typing_env.rec.mli
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ val find_or_missing : t -> Name.t -> Type_grammar.t option

val find_params : t -> Kinded_parameter.t list -> Type_grammar.t list

val find_depth_variable : t -> Depth_variable.t -> Rec_info_expr.t

val find_depth_variable_or_missing
: t
-> Depth_variable.t
-> Rec_info_expr.t option

val variable_is_from_missing_cmx_file : t -> Name.t -> bool

val mem : ?min_name_mode:Name_mode.t -> t -> Name.t -> bool
Expand Down
7 changes: 7 additions & 0 deletions middle_end/flambda/types/flambda_type.mli
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ module Typing_env : sig

val find_params : t -> Kinded_parameter.t list -> flambda_type list

val find_depth_variable : t -> Depth_variable.t -> Rec_info_expr.t

val find_depth_variable_or_missing
: t
-> Depth_variable.t
-> Rec_info_expr.t option

val add_env_extension : t -> Typing_env_extension.t -> t

val add_env_extension_with_extra_variables
Expand Down