summaryrefslogtreecommitdiff
path: root/typing/btype.ml
diff options
context:
space:
mode:
Diffstat (limited to 'typing/btype.ml')
-rw-r--r--typing/btype.ml20
1 files changed, 20 insertions, 0 deletions
diff --git a/typing/btype.ml b/typing/btype.ml
index caa0b43f2f..c92df0ffd6 100644
--- a/typing/btype.ml
+++ b/typing/btype.ml
@@ -138,6 +138,26 @@ let proxy ty =
in proxy_obj ty
| _ -> ty
+(**** Utilities for private types ****)
+
+let has_constr_row t =
+ match (repr t).desc with
+ Tobject(t,_) ->
+ let rec check_row t =
+ match (repr t).desc with
+ Tfield(_,_,_,t) -> check_row t
+ | Tconstr _ -> true
+ | _ -> false
+ in check_row t
+ | Tvariant row ->
+ (match row_more row with {desc=Tconstr _} -> true | _ -> false)
+ | _ ->
+ false
+
+let is_row_name s =
+ let l = String.length s in
+ if l < 4 then false else String.sub s (l-4) 4 = "#row"
+
(**********************************)
(* Utilities for type traversal *)