Pārlūkot izejas kodu

added Type.is_value_type

Simon Krajewski 12 gadi atpakaļ
vecāks
revīzija
ce1de5c00f
1 mainītis faili ar 12 papildinājumiem un 0 dzēšanām
  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 =