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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/typechecker/typechecker.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/typechecker/typechecker.sml

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

revision 2133, Sun Feb 10 20:40:26 2013 UTC revision 2134, Mon Feb 11 12:32:58 2013 UTC
# Line 118  Line 118 
118              then err (cxt, [S "differentiation must be >= 0"])              then err (cxt, [S "differentiation must be >= 0"])
119              else Ty.DiffConst(IntInf.toInt k)              else Ty.DiffConst(IntInf.toInt k)
120    
121      (* check a sequence dimension, which must be > 0 *)
122        fun checkSeqDim (cxt, d) =
123              if (d < 0)
124                then err (cxt, [S "invalid dimension; must be positive"])
125                else Ty.DimConst(IntInf.toInt d)
126    
127    (* check a dimension, which must be 1, 2 or 3 *)    (* check a dimension, which must be 1, 2 or 3 *)
128      fun checkDim (cxt, d) =      fun checkDim (cxt, d) =
129            if (d < 1) orelse (3 < d)            if (d < 1) orelse (3 < d)
# Line 158  Line 164 
164                  val ty = checkTy(cxt, ty)                  val ty = checkTy(cxt, ty)
165                  in                  in
166                    if TU.isFixedSizeType ty                    if TU.isFixedSizeType ty
167                      then Ty.T_Sequence(ty, checkDim (cxt, dim))                      then Ty.T_Sequence(ty, checkSeqDim (cxt, dim))
168                      else err(cxt, [S "elements of sequence types must be fixed-size types"])                      else err(cxt, [S "elements of sequence types must be fixed-size types"])
169                  end                  end
170              | PT.T_DynSeq ty => let              | PT.T_DynSeq ty => let
# Line 872  Line 878 
878                    checkForRedef (env, cxt, x);                    checkForRedef (env, cxt, x);
879                    (AST.D_Var(AST.VD_Decl(x', e')), insertGlobal(env, cxt, x, x'))                    (AST.D_Var(AST.VD_Decl(x', e')), insertGlobal(env, cxt, x, x'))
880                  end                  end
881              | PT.D_Fun(ty, f, params, body) => let              | PT.D_Func(ty, f, params, body) => let
882                  val ty' = checkTy(cxt, ty)                  val ty' = checkTy(cxt, ty)
883                  val (params', env') = checkParams (env, cxt, params)                  val (params', env') = checkParams (env, cxt, params)
884                  val body' = (case body                  val body' = (case body
# Line 894  Line 900 
900                  val f' = Var.new (f, AST.FunVar, fnTy)                  val f' = Var.new (f, AST.FunVar, fnTy)
901                  in                  in
902  (* QUESTION: should we check for redefinition of the function? *)  (* QUESTION: should we check for redefinition of the function? *)
903                    (AST.D_Fun(f', params', body'), insertFunc(env, cxt, f, f'))                    (AST.D_Func(f', params', body'), insertFunc(env, cxt, f, f'))
904                  end                  end
905              | PT.D_Strand arg => (checkStrand(strandScope env, cxt, arg), env)              | PT.D_Strand arg => (checkStrand(strandScope env, cxt, arg), env)
906              | PT.D_InitialArray(create, iterators) => let              | PT.D_InitialArray(create, iterators) => let

Legend:
Removed from v.2133  
changed lines
  Added in v.2134

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