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

SCM Repository

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

Diff of /branches/vis15/src/compiler/typechecker/env.sml

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

revision 3430, Fri Nov 13 22:24:24 2015 UTC revision 3431, Sat Nov 14 14:03:58 2015 UTC
# Line 26  Line 26 
26        | CreateScope                             (* inside initial strand creation *)        | CreateScope                             (* inside initial strand creation *)
27        | UpdateScope                             (* inside global update *)        | UpdateScope                             (* inside global update *)
28    
29      (* string representation of scope *)
30      val scopeToString : scope -> string      val scopeToString : scope -> string
31    
32      (* return the current scope *)
33      val currentScope : t -> scope      val currentScope : t -> scope
34    
35      (* are we currently in a strand method scope? *)
36      val inMethod : t -> bool      val inMethod : t -> bool
37    
38      (* are we currently in a strand scope? *)
39      val inStrand : t -> bool      val inStrand : t -> bool
40    
41      (* are we currently in a global update block? *)
42        val inGlobalUpdate : t -> bool
43    
44    (* start a new function scope *)    (* start a new function scope *)
45      val functionScope : t * Types.ty * Atom.atom -> t      val functionScope : t * Types.ty * Atom.atom -> t
46    (* start a new strand scope *)    (* start a new strand scope *)
# Line 70  Line 77 
77      val findFunc : t * Atom.atom -> fun_def      val findFunc : t * Atom.atom -> fun_def
78      val findVar : t * Atom.atom -> AST.var option      val findVar : t * Atom.atom -> AST.var option
79    
80      (* find the strand-set function with the given name *)
81        val findSetFn : t * Atom.atom -> AST.var option
82    
83    (* unwrap a parse-tree location marker and update the context with the span *)    (* unwrap a parse-tree location marker and update the context with the span *)
84      val withContext : context * 'a Error.mark -> (context * 'a)      val withContext : context * 'a Error.mark -> (context * 'a)
85    
# Line 80  Line 90 
90      val checkForRedef : t * context * Atom.atom -> unit      val checkForRedef : t * context * Atom.atom -> unit
91    
92    (* tracking program features *)    (* tracking program features *)
93      val recordProp : t * StrandUtil.program_prop -> unit      val recordProp : t * Properties.t -> unit
94      val properties : t -> StrandUtil.program_prop list      val properties : t -> Properties.t list
95    
96    end = struct    end = struct
97    
# Line 151  Line 161 
161        | inStrand (E{scope=MethodScope _, ...}) = true        | inStrand (E{scope=MethodScope _, ...}) = true
162        | inStrand _ = false        | inStrand _ = false
163    
164        fun inGlobalUpdate (E{scope=UpdateScope, ...}) = true
165          | inGlobalUpdate _ = false
166    
167      fun findStrand (E{gEnv, ...}, s) = GE.findStrand(gEnv, s)      fun findStrand (E{gEnv, ...}, s) = GE.findStrand(gEnv, s)
168      fun findFunc (E{gEnv, ...}, f) = GE.findFunc(gEnv, f)      fun findFunc (E{gEnv, ...}, f) = GE.findFunc(gEnv, f)
169      fun findVar (E{gEnv, vEnv, ...}, x) = (case AMap.find(vEnv, x)      fun findVar (E{gEnv, vEnv, ...}, x) = (case AMap.find(vEnv, x)
# Line 158  Line 171 
171              | someVar => someVar              | someVar => someVar
172            (* end case *))            (* end case *))
173    
174      (* find the strand-set function with the given name; we do this by brute force
175       * for now.
176       *)
177        fun findSetFn (_, name) =
178              if Atom.same(name, BasisNames.set_active) then SOME BasisVars.set_active
179              else if Atom.same(name, BasisNames.set_all) then SOME BasisVars.set_all
180              else if Atom.same(name, BasisNames.set_stable) then SOME BasisVars.set_stable
181              else NONE
182    
183      fun insertGlobal (E{scope, bindings, gEnv, vEnv}, cxt, x, x') = let      fun insertGlobal (E{scope, bindings, gEnv, vEnv}, cxt, x, x') = let
184            val loc = Error.location cxt            val loc = Error.location cxt
185            in            in

Legend:
Removed from v.3430  
changed lines
  Added in v.3431

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