Mercurial > urweb
comparison src/compiler.sml @ 1092:6f4b05fc4361
Catch attempts to mention multiple versions of the same rooted module
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Fri, 25 Dec 2009 10:48:02 -0500 |
parents | e77079953308 |
children | db52c32dbe42 |
comparison
equal
deleted
inserted
replaced
1091:6e5463a53c3c | 1092:6f4b05fc4361 |
---|---|
429 serverOnly = #serverOnly old @ #serverOnly new, | 429 serverOnly = #serverOnly old @ #serverOnly new, |
430 jsFuncs = #jsFuncs old @ #jsFuncs new, | 430 jsFuncs = #jsFuncs old @ #jsFuncs new, |
431 rewrites = #rewrites old @ #rewrites new, | 431 rewrites = #rewrites old @ #rewrites new, |
432 filterUrl = #filterUrl old @ #filterUrl new, | 432 filterUrl = #filterUrl old @ #filterUrl new, |
433 filterMime = #filterMime old @ #filterMime new, | 433 filterMime = #filterMime old @ #filterMime new, |
434 sources = #sources new @ #sources old, | 434 sources = #sources new |
435 @ List.filter (fn s => List.all (fn s' => s' <> s) (#sources new)) | |
436 (#sources old), | |
435 protocol = mergeO #2 (#protocol old, #protocol new), | 437 protocol = mergeO #2 (#protocol old, #protocol new), |
436 dbms = mergeO #2 (#dbms old, #dbms new) | 438 dbms = mergeO #2 (#dbms old, #dbms new) |
437 } | 439 } |
438 in | 440 in |
439 if accLibs then | 441 if accLibs then |
679 checkErrors (); | 681 checkErrors (); |
680 (Source.DFfiStr (mname, sgn), loc) | 682 (Source.DFfiStr (mname, sgn), loc) |
681 end | 683 end |
682 | 684 |
683 val defed = ref SS.empty | 685 val defed = ref SS.empty |
686 val fulls = ref SS.empty | |
684 | 687 |
685 fun parseOne fname = | 688 fun parseOne fname = |
686 let | 689 let |
687 val mname = nameOf fname | 690 val mname = nameOf fname |
688 val ur = OS.Path.joinBaseExt {base = fname, ext = SOME "ur"} | 691 val ur = OS.Path.joinBaseExt {base = fname, ext = SOME "ur"} |
714 val pieces = name :: String.tokens (fn ch => ch = #"/") fname | 717 val pieces = name :: String.tokens (fn ch => ch = #"/") fname |
715 val pieces = List.filter (fn s => size s > 0 | 718 val pieces = List.filter (fn s => size s > 0 |
716 andalso Char.isAlpha (String.sub (s, 0))) | 719 andalso Char.isAlpha (String.sub (s, 0))) |
717 pieces | 720 pieces |
718 val pieces = map capitalize pieces | 721 val pieces = map capitalize pieces |
722 val full = String.concatWith "." pieces | |
719 | 723 |
720 fun makeD prefix pieces = | 724 fun makeD prefix pieces = |
721 case pieces of | 725 case pieces of |
722 [] => (ErrorMsg.error "Empty module path"; | 726 [] => (ErrorMsg.error "Empty module path"; |
723 (Source.DStyle "Boo", loc)) | 727 (Source.DStyle "Boo", loc)) |
736 else | 740 else |
737 [makeD prefix pieces]), loc)), | 741 [makeD prefix pieces]), loc)), |
738 loc) | 742 loc) |
739 end | 743 end |
740 in | 744 in |
745 if SS.member (!fulls, full) then | |
746 ErrorMsg.error ("Rooted module " ^ full ^ " has multiple versions.") | |
747 else | |
748 (); | |
749 fulls := SS.add (!fulls, full); | |
750 | |
741 makeD "" pieces | 751 makeD "" pieces |
742 end | 752 end |
743 in | 753 in |
744 checkErrors (); | 754 checkErrors (); |
745 d | 755 d |