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 274, Fri May 14 05:23:02 1999 UTC revision 275, Sat May 15 09:54:52 1999 UTC
# Line 14  Line 14 
14      type symbol = GenericVC.Symbol.symbol      type symbol = GenericVC.Symbol.symbol
15      type smlinfo = SmlInfo.info      type smlinfo = SmlInfo.info
16    
     exception DuplicateImport of symbol * string * string  
     exception DuplicateDefinition of symbol * string * string  
   
17      type collection      type collection
18    
19      val empty : collection      val empty : collection
20    
21      val expandOne : (AbsPath.t -> DependencyGraph.farnode SymbolMap.map)      val expandOne : (AbsPath.t -> DependencyGraph.farnode SymbolMap.map)
22          -> { sourcepath: AbsPath.t, group: AbsPath.t, class: string option }          -> { sourcepath: AbsPath.t, group: AbsPath.t, class: string option,
23                 error : string -> unit }
24          -> collection          -> collection
25      val sequential : collection * collection -> collection      val sequential : collection * collection * (string -> unit) -> collection
26    
27      val num_look : collection -> string -> int      val num_look : collection -> string -> int
28      val ml_look : collection -> GenericVC.Symbol.symbol -> bool      val ml_look : collection -> GenericVC.Symbol.symbol -> bool
# Line 34  Line 32 
32  structure MemberCollection :> MEMBERCOLLECTION = struct  structure MemberCollection :> MEMBERCOLLECTION = struct
33    
34      structure DG = DependencyGraph      structure DG = DependencyGraph
35        structure Symbol = GenericVC.Symbol
36    
37      type smlinfo = SmlInfo.info      type smlinfo = SmlInfo.info
38      type symbol = GenericVC.Symbol.symbol      type symbol = Symbol.symbol
   
     exception DuplicateImport of symbol * string * string  
     exception DuplicateDefinition of symbol * string * string  
39    
40      datatype collection =      datatype collection =
41          COLLECTION of { subexports: DG.farnode SymbolMap.map,          COLLECTION of { subexports: DG.farnode SymbolMap.map,
# Line 51  Line 47 
47                       smlfiles = [],                       smlfiles = [],
48                       localdefs = SymbolMap.empty }                       localdefs = SymbolMap.empty }
49    
50      fun sequential (COLLECTION c1, COLLECTION c2) = let      fun sequential (COLLECTION c1, COLLECTION c2, error) = let
51          fun se_error (s, (_, n1), (_, n2)) =          fun describeSymbol (s, r) = let
52              raise DuplicateImport (s, DG.describeNode n1, DG.describeNode n2)              val ns = Symbol.nameSpace s
53            in
54                Symbol.nameSpaceToString ns :: " " :: Symbol.name s :: r
55            end
56            fun se_error (s, x as (_, n1), (_, n2)) =
57                (error (concat (describeSymbol
58                                (s, [" imported from ", DG.describeNode n1,
59                                     " and also from ", DG.describeNode n2])));
60                 x)
61          val se_union = SymbolMap.unionWithi se_error          val se_union = SymbolMap.unionWithi se_error
62          fun ld_error (s, f1, f2) =          fun ld_error (s, f1, f2) =
63              raise DuplicateDefinition (s, SmlInfo.describe f1,              (error (concat (describeSymbol
64                                            SmlInfo.describe f2)                              (s, [" defined in ", SmlInfo.describe f1,
65                                     " and also in ", SmlInfo.describe f2])));
66                 f1)
67          val ld_union = SymbolMap.unionWithi ld_error          val ld_union = SymbolMap.unionWithi ld_error
   
68      in      in
69          COLLECTION { subexports = se_union (#subexports c1, #subexports c2),          COLLECTION { subexports = se_union (#subexports c1, #subexports c2),
70                       smlfiles = #smlfiles c1 @ #smlfiles c2,                       smlfiles = #smlfiles c1 @ #smlfiles c2,
71                       localdefs = ld_union (#localdefs c1, #localdefs c2) }                       localdefs = ld_union (#localdefs c1, #localdefs c2) }
72      end      end
73    
74      fun expandOne gexports { sourcepath, group, class } = let      fun expandOne gexports { sourcepath, group, class, error } = let
75          fun noPrimitive () = let          fun noPrimitive () = let
76              val expansions = PrivateTools.expand (sourcepath, class)              val expansions = PrivateTools.expand error (sourcepath, class)
77              fun exp2coll (PrivateTools.GROUP p) =              fun exp2coll (PrivateTools.GROUP p) =
78                  COLLECTION { subexports = gexports p,                  COLLECTION { subexports = gexports p,
79                               smlfiles = [],                               smlfiles = [],
# Line 77  Line 82 
82                      val { sourcepath = p, history = h, share = s } = src                      val { sourcepath = p, history = h, share = s } = src
83                      val i =  SmlInfo.new                      val i =  SmlInfo.new
84                          Policy.default                          Policy.default
85                          { sourcepath = p, group = group, history = h,                          { sourcepath = p, group = group,
86                              error = error, history = h,
87                            share = s, stableinfo = NONE }                            share = s, stableinfo = NONE }
88                      val exports = SmlInfo.exports i                      val exports = SmlInfo.exports i
89                      fun addLD (s, m) = SymbolMap.insert (m, s, i)                      fun addLD (s, m) = SymbolMap.insert (m, s, i)
# Line 88  Line 94 
94                                   localdefs = ld }                                   localdefs = ld }
95                  end                  end
96              val collections = map exp2coll expansions              val collections = map exp2coll expansions
97              fun combine (c1, c2) = sequential (c2, c1)              fun combine (c1, c2) = sequential (c2, c1, error)
98          in          in
99              foldl combine empty collections              foldl combine empty collections
100          end          end

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

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