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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/simplify/util.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/simplify/util.sml

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

revision 4162, Wed Jul 6 07:04:28 2016 UTC revision 4163, Thu Jul 7 09:45:19 2016 UTC
# Line 18  Line 18 
18            }            }
19    
20    (* convert a block into a function by closing over its free variables *)    (* convert a block into a function by closing over its free variables *)
21      val makeFunction : string * Simple.block * SimpleTypes.ty -> Simple.func * Simple.var list      val makeFunction : string * Simple.block * SimpleTypes.ty -> Simple.func_def * Simple.var list
22    
23    end = struct    end = struct
24    
# Line 155  Line 155 
155                        in                        in
156                          (env, S.E_Select(x', fld))                          (env, S.E_Select(x', fld))
157                         end                         end
158                    | S.E_Apply(f, args, ty) => let                    | S.E_Apply(f, args) => let
159                        val (env, args') = cvtVars (env, args)                        val (env, args') = cvtVars (env, args)
160                        in                        in
161                          (env, S.E_Apply(f, args', ty))                          (env, S.E_Apply(f, args'))
162                        end                        end
163                    | S.E_Prim(f, mvs, args, ty) => let                    | S.E_Prim(f, mvs, args, ty) => let
164                        val (env, args') = cvtVars (env, args)                        val (env, args') = cvtVars (env, args)
# Line 202  Line 202 
202                  (* end case *))                  (* end case *))
203            val (env, blk) = cvtBlock (VMap.empty, blk)            val (env, blk) = cvtBlock (VMap.empty, blk)
204            val (args, params) = ListPair.unzip (List.rev (! freeVars))            val (args, params) = ListPair.unzip (List.rev (! freeVars))
205            val fnTy = SimpleTypes.T_Fun(List.map SimpleVar.typeOf params, resTy)            val f = SimpleFunc.new (name, resTy, List.map SimpleVar.typeOf params)
206            in            in
207              (S.Func{f=mkFuncId(name, fnTy), params=params, body=blk}, args)              (S.Func{f=f, params=params, body=blk}, args)
208            end            end
209      end (* local *)      end (* local *)
210    

Legend:
Removed from v.4162  
changed lines
  Added in v.4163

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