Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/compiler/ast/type-util.sml
ViewVC logotype

Diff of /trunk/src/compiler/ast/type-util.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2635, Mon May 26 14:06:39 2014 UTC revision 2636, Tue May 27 16:18:36 2014 UTC
# Line 21  Line 21 
21     *)     *)
22      val slice : Types.ty * bool list -> Types.ty      val slice : Types.ty * bool list -> Types.ty
23    
24    (* returns true if the type is a value type (bool, int, string, or tensor) *)    (* returns true if the type is a has a static size (i.e., not a dynamic sequence) *)
25        val isFixedSizeType : Types.ty -> bool
26    
27      (* returns true if the type is a value type (bool, int, string, tensor, seq, ...) *)
28      val isValueType : Types.ty -> bool      val isValueType : Types.ty -> bool
29    
30      (* return true if the type is an image type *)
31        val isImageType : Types.ty -> bool
32    
33    (* return the range (return type) of a function type *)    (* return the range (return type) of a function type *)
34      val rngOf : Types.ty -> Types.ty      val rngOf : Types.ty -> Types.ty
35    
# Line 174  Line 180 
180              prune' ty              prune' ty
181            end            end
182    
183        fun isFixedSizeType ty = (case prune ty
184               of Ty.T_Bool => true
185                | Ty.T_Int => true
186                | Ty.T_String => true
187                | Ty.T_Sequence _ => true
188                | Ty.T_Tensor _ => true
189                | _ => false
190              (* end case *))
191    
192    (* returns true if the type is a value type (bool, int, string, or tensor) *)    (* returns true if the type is a value type (bool, int, string, or tensor) *)
193      fun isValueType ty = (case prune ty      fun isValueType ty = (case prune ty
194             of Ty.T_Bool => true             of Ty.T_Bool => true
# Line 184  Line 199 
199              | _ => false              | _ => false
200            (* end case *))            (* end case *))
201    
202      (* returns true if the type is an ImageTy *)
203        fun isImageType ty = (case prune ty
204               of Ty.T_Image _ => true
205                | _ => false
206              (* end case *))
207    
208    (* equality testing *)    (* equality testing *)
209      fun sameDim (Ty.DimConst d1, Ty.DimConst d2) = (d1 = d2)      fun sameDim (Ty.DimConst d1, Ty.DimConst d2) = (d1 = d2)
210        | sameDim (Ty.DimVar v1, Ty.DimVar v2) = MetaVar.sameDimVar(v1, v2)        | sameDim (Ty.DimVar v1, Ty.DimVar v2) = MetaVar.sameDimVar(v1, v2)

Legend:
Removed from v.2635  
changed lines
  Added in v.2636

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0