Types.
This commit is contained in:
parent
6adb45c3ad
commit
12bd4e9c45
|
@ -31,13 +31,11 @@ and ty =
|
||||||
| Tprod of ty list (** Product type used for tuples *)
|
| Tprod of ty list (** Product type used for tuples *)
|
||||||
| Tid of type_name (** Usable type_name are alias or pervasives {bool,int,float} (see [Initial]) *)
|
| Tid of type_name (** Usable type_name are alias or pervasives {bool,int,float} (see [Initial]) *)
|
||||||
| Tarray of ty * static_exp (** [base_type] * [size] *) (* TODO obc : array of prod ?? nonono *)
|
| Tarray of ty * static_exp (** [base_type] * [size] *) (* TODO obc : array of prod ?? nonono *)
|
||||||
| Tmutable of ty (* TODO obc : do not hack it here *)
|
| Tinvalid
|
||||||
| Tunit
|
|
||||||
|
|
||||||
let invalid_type = Tprod [] (** Invalid type given to untyped expression etc. *)
|
let invalid_type = Tinvalid (** Invalid type given to untyped expression etc. *)
|
||||||
|
|
||||||
let prod = function
|
let prod = function
|
||||||
| [] -> Tunit
|
|
||||||
| [ty] -> ty
|
| [ty] -> ty
|
||||||
| ty_list -> Tprod ty_list
|
| ty_list -> Tprod ty_list
|
||||||
|
|
||||||
|
@ -45,9 +43,7 @@ let unprod = function
|
||||||
| Tprod l -> l
|
| Tprod l -> l
|
||||||
| t -> [t]
|
| t -> [t]
|
||||||
|
|
||||||
|
let mk_static_exp ?(loc = no_location) ty desc = (*note ~ty: replace as first arg*)
|
||||||
(** DO NOT use this after the typing, since it could give invalid_type *)
|
|
||||||
let mk_static_exp ?(loc = no_location) ?(ty = invalid_type) desc =
|
|
||||||
{ se_desc = desc; se_ty = ty; se_loc = loc }
|
{ se_desc = desc; se_ty = ty; se_loc = loc }
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue