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 3190, Sat Apr 4 00:18:24 2015 UTC revision 3191, Sat Apr 4 00:33:02 2015 UTC
# Line 64  Line 64 
64      fun blockScope {scope, bindings, env} =      fun blockScope {scope, bindings, env} =
65            {scope=scope, bindings=AtomMap.empty, env=env}            {scope=scope, bindings=AtomMap.empty, env=env}
66    
67        fun inMethod {scope=MethodScope _, bindings, env} = true
68          | inMethod _ = false
69    
70      fun inStrand {scope=StrandScope, bindings, env} = true      fun inStrand {scope=StrandScope, bindings, env} = true
71        | inStrand {scope=MethodScope _, ...} = true        | inStrand {scope=MethodScope _, ...} = true
72        | inStrand _ = false        | inStrand _ = false
# Line 655  Line 658 
658     * by simplify.     * by simplify.
659     *)     *)
660      fun chkCtlFlow (cxt, scope, stm) = let      fun chkCtlFlow (cxt, scope, stm) = let
661            val (inFun, inUpdate, funName) = (case scope            val (inFun, inInitOrUpdate, funName) = (case scope
662                   of FunctionScope(_, f) => (true, false, Atom.toString f)                   of FunctionScope(_, f) => (true, false, Atom.toString f)
663                      | MethodScope StrandUtil.Initially => (false, true, "")
664                    | MethodScope StrandUtil.Update => (false, true, "")                    | MethodScope StrandUtil.Update => (false, true, "")
665                    | _ => (false, false, "")                    | _ => (false, false, "")
666                  (* end case *))                  (* end case *))
# Line 697  Line 701 
701                      else escapes                      else escapes
702                  end                  end
703              | chk (cxt, _, _, _, PT.S_New _) = (              | chk (cxt, _, _, _, PT.S_New _) = (
704                  if not inUpdate                  if not inInitOrUpdate
705                    then err(cxt, [S "\"new\" statement outside of update method"])                    then err(cxt, [S "\"new\" statement outside of initially/update method"])
706                    else ();                    else ();
707                  false)                  false)
708              | chk (cxt, hasSucc, isJoin, unreachable, PT.S_Die) = (              | chk (cxt, hasSucc, isJoin, unreachable, PT.S_Die) = (
709                  if not inUpdate                  if not inInitOrUpdate
710                    then err(cxt, [S "\"die\" statment outside of update method"])                    then err(cxt, [S "\"die\" statment outside of initially/update method"])
711                  else if hasSucc andalso not isJoin andalso not unreachable                  else if hasSucc andalso not isJoin andalso not unreachable
712                    then warn(cxt, [S "statements following \"die\" statment are unreachable"])                    then warn(cxt, [S "statements following \"die\" statment are unreachable"])
713                    else ();                    else ();
714                  true)                  true)
715                | chk (cxt, hasSucc, isJoin, unreachable, PT.S_Continue) = (
716                    if not inInitOrUpdate
717                      then err(cxt, [S "\"continue\" statment outside of initially/update method"])
718                    else if hasSucc andalso not isJoin andalso not unreachable
719                      then warn(cxt, [S "statements following \"continue\" statment are unreachable"])
720                      else ();
721                    true)
722              | chk (cxt, hasSucc, isJoin, unreachable, PT.S_Stabilize) = (              | chk (cxt, hasSucc, isJoin, unreachable, PT.S_Stabilize) = (
723                  if not inUpdate                  if not inInitOrUpdate
724                    then err(cxt, [S "\"stabilize\" statment outside of update method"])                    then err(cxt, [S "\"stabilize\" statment outside of initially/update method"])
725                  else if hasSucc andalso not isJoin andalso not unreachable                  else if hasSucc andalso not isJoin andalso not unreachable
726                    then warn(cxt, [S "statements following \"stabilize\" statment are unreachable"])                    then warn(cxt, [S "statements following \"stabilize\" statment are unreachable"])
727                    else ();                    else ();
# Line 863  Line 874 
874                          Env.recordProp (#env env, StrandUtil.NewStrands);                          Env.recordProp (#env env, StrandUtil.NewStrands);
875                          (AST.S_New(strand, args), env)                          (AST.S_New(strand, args), env)
876                        end                        end
877                      | PT.S_Continue => (AST.S_Continue, env) (* note that scope has already been checked in chkCtlFlow *)
878                    | PT.S_Die => (                    | PT.S_Die => (
879                      (* note that scope has already been checked in chkCtlFlow *)                      (* note that scope has already been checked in chkCtlFlow *)
880                        Env.recordProp (#env env, StrandUtil.StrandsMayDie);                        Env.recordProp (#env env, StrandUtil.StrandsMayDie);

Legend:
Removed from v.3190  
changed lines
  Added in v.3191

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