Browse Source

added Type.is_value_type

Simon Krajewski 12 năm trước cách đây
mục cha
commit
ce1de5c00f
1 tập tin đã thay đổi với 12 bổ sung0 xóa
  1. 12 0
      type.ml

+ 12 - 0
type.ml

@@ -627,6 +627,18 @@ let rec is_null = function
 	| _ ->
 		false
 
+let rec is_value_type = function
+	| TMono r ->
+		(match !r with None -> false | Some t -> is_value_type t)
+	| TType (t,tl) ->
+		is_value_type (apply_params t.t_types tl t.t_type)
+	| TInst({cl_path=[],"String"},[]) ->
+		true
+	| TAbstract _ ->
+		true
+	| _ ->
+		false
+
 let rec link e a b =
 	(* tell if setting a == b will create a type-loop *)
 	let rec loop t =