Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/cm/semant/members.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/semant/members.sml

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

revision 273, Wed May 12 08:38:51 1999 UTC revision 274, Fri May 14 05:23:02 1999 UTC
# Line 19  Line 19 
19    
20      type collection      type collection
21    
22        val empty : collection
23    
24      val expandOne : (AbsPath.t -> DependencyGraph.farnode SymbolMap.map)      val expandOne : (AbsPath.t -> DependencyGraph.farnode SymbolMap.map)
25          -> { sourcepath: AbsPath.t, group: AbsPath.t, class: string option }          -> { sourcepath: AbsPath.t, group: AbsPath.t, class: string option }
26          -> collection          -> collection
# Line 44  Line 46 
46                          smlfiles: smlinfo list,                          smlfiles: smlinfo list,
47                          localdefs: smlinfo SymbolMap.map }                          localdefs: smlinfo SymbolMap.map }
48    
49        val empty =
50            COLLECTION { subexports = SymbolMap.empty,
51                         smlfiles = [],
52                         localdefs = SymbolMap.empty }
53    
54      fun sequential (COLLECTION c1, COLLECTION c2) = let      fun sequential (COLLECTION c1, COLLECTION c2) = let
55          fun se_error (s, (_, n1), (_, n2)) =          fun se_error (s, (_, n1), (_, n2)) =
56              raise DuplicateImport (s, DG.describeNode n1, DG.describeNode n2)              raise DuplicateImport (s, DG.describeNode n1, DG.describeNode n2)
# Line 60  Line 67 
67      end      end
68    
69      fun expandOne gexports { sourcepath, group, class } = let      fun expandOne gexports { sourcepath, group, class } = let
70            fun noPrimitive () = let
71          val expansions = PrivateTools.expand (sourcepath, class)          val expansions = PrivateTools.expand (sourcepath, class)
72          fun exp2coll (PrivateTools.GROUP p) =          fun exp2coll (PrivateTools.GROUP p) =
73              COLLECTION { subexports = gexports p,              COLLECTION { subexports = gexports p,
74                           smlfiles = [],                           smlfiles = [],
75                           localdefs = SymbolMap.empty }                           localdefs = SymbolMap.empty }
           | exp2coll (PrivateTools.PRIMITIVE p) = let  
                 val exports = Primitive.exports p  
                 fun addFN (s, m) =  
                     SymbolMap.insert (m, s, (NONE, DG.PNODE p))  
                 val se = SymbolSet.foldl addFN SymbolMap.empty exports  
             in  
                 COLLECTION { subexports = se,  
                              smlfiles = [],  
                              localdefs = SymbolMap.empty }  
             end  
76            | exp2coll (PrivateTools.SMLSOURCE src) = let            | exp2coll (PrivateTools.SMLSOURCE src) = let
77                  val { sourcepath = p, history = h, share = s } = src                  val { sourcepath = p, history = h, share = s } = src
78                  val i =  SmlInfo.new { sourcepath = p, group = group,                      val i =  SmlInfo.new
79                                         history = h, share = s,                          Policy.default
80                                         stableinfo = NONE }                          { sourcepath = p, group = group, history = h,
81                              share = s, stableinfo = NONE }
82                  val exports = SmlInfo.exports i                  val exports = SmlInfo.exports i
83                  fun addLD (s, m) = SymbolMap.insert (m, s, i)                  fun addLD (s, m) = SymbolMap.insert (m, s, i)
84                  val ld = SymbolSet.foldl addLD SymbolMap.empty exports                  val ld = SymbolSet.foldl addLD SymbolMap.empty exports
# Line 88  Line 87 
87                               smlfiles = [i],                               smlfiles = [i],
88                               localdefs = ld }                               localdefs = ld }
89              end              end
   
90          val collections = map exp2coll expansions          val collections = map exp2coll expansions
         val empty = COLLECTION { subexports = SymbolMap.empty,  
                                  smlfiles = [],  
                                  localdefs = SymbolMap.empty }  
91          fun combine (c1, c2) = sequential (c2, c1)          fun combine (c1, c2) = sequential (c2, c1)
92      in      in
93          foldl combine empty collections          foldl combine empty collections
94      end      end
95        in
96            if isSome class then noPrimitive ()
97            else case Primitive.fromString (AbsPath.spec sourcepath) of
98                SOME p => let
99                    val exports = Primitive.exports p
100                    fun addFN (s, m) =
101                        SymbolMap.insert (m, s, (NONE, DG.PNODE p))
102                    val se = SymbolSet.foldl addFN SymbolMap.empty exports
103                in
104                    COLLECTION { subexports = se,
105                                 smlfiles = [],
106                                 localdefs = SymbolMap.empty }
107                end
108              | NONE => noPrimitive ()
109        end
110    
111      fun num_look (c: collection) (s: string) = 0      fun num_look (c: collection) (s: string) = 0
112    

Legend:
Removed from v.273  
changed lines
  Added in v.274

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