Project

General

Profile

Revision 3b2bd83d src/types.ml

View differences:

src/types.ml
173 173

  
174 174
let new_id = ref (-1)
175 175

  
176
let rec bottom =
177
  { tdesc = Tlink bottom; tid = -666 }
178

  
176 179
let new_ty desc =
177 180
  incr new_id; {tdesc = desc; tid = !new_id }
178 181

  
......
198 201
  | Tstruct fl -> (try Some (List.assoc label fl) with Not_found -> None)
199 202
  | _          -> None
200 203

  
201
let is_numeric_type ty =
204
let rec is_scalar_type ty =
205
  match (repr ty).tdesc with
206
  | Tstatic (_, ty) -> is_scalar_type ty
207
  | Tbool
208
  | Tint
209
  | Treal -> true
210
  | _     -> false
211

  
212
let rec is_numeric_type ty =
202 213
 match (repr ty).tdesc with
214
 | Tstatic (_, ty) -> is_numeric_type ty
203 215
 | Tint
204 216
 | Treal -> true
205 217
 | _     -> false
206 218

  
207
let is_bool_type ty =
219
let rec is_real_type ty =
220
 match (repr ty).tdesc with
221
 | Tstatic (_, ty) -> is_real_type ty
222
 | Treal -> true
223
 | _     -> false
224

  
225
let rec is_bool_type ty =
208 226
 match (repr ty).tdesc with
227
 | Tstatic (_, ty) -> is_bool_type ty
209 228
 | Tbool -> true
210 229
 | _     -> false
211 230

  
......
288 307
  | _                -> ty
289 308

  
290 309
let is_address_type ty =
291
  is_array_type ty || is_struct_type ty
310
  is_array_type ty || is_struct_type ty || (is_real_type ty && !Options.mpfr)
292 311

  
293 312
let rec is_generic_type ty =
294 313
 match (dynamic_type ty).tdesc with
......
313 332
  else
314 333
    List.hd tyl
315 334

  
316
let type_list_of_type ty =
335
let rec type_list_of_type ty =
317 336
 match (repr ty).tdesc with
318
 | Ttuple tl -> tl
319
 | _         -> [ty]
337
 | Tstatic (_, ty) -> type_list_of_type ty
338
 | Ttuple tl       -> tl
339
 | _               -> [ty]
320 340

  
321 341
(** [is_polymorphic ty] returns true if [ty] is polymorphic. *)
322 342
let rec is_polymorphic ty =

Also available in: Unified diff