X-Git-Url: https://git.xandkar.net/?p=tiger.ml.git;a=blobdiff_plain;f=compiler%2Fsrc%2Flib%2Ftiger%2Ftiger_env_type.ml;h=4d99a0d7e8dc2313e9db1ba8f69ad5158311de89;hp=bb8cdd605f54499df41f01d4dc3a08ef34446ce0;hb=161a300dddce2df54b21863ae94e2dda281906fd;hpb=523e2b063b9ba20329af61e18dc9a5ccbaca06a0 diff --git a/compiler/src/lib/tiger/tiger_env_type.ml b/compiler/src/lib/tiger/tiger_env_type.ml index bb8cdd6..4d99a0d 100644 --- a/compiler/src/lib/tiger/tiger_env_type.ml +++ b/compiler/src/lib/tiger/tiger_env_type.ml @@ -97,6 +97,18 @@ let if_record t ~f ~otherwise = | Array _ -> otherwise () +let if_array t ~f ~otherwise = + match t with + | Array {ty=t; _} -> + f t + | Unit + | Int + | String + | Name _ + | Nil + | Record _ -> + otherwise () + let to_string = function | Unit -> "unit" | Nil -> "nil"