/[svn]/typing/typer.ml
ViewVC logotype

Diff of /typing/typer.ml

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

revision 46 by abate, Tue Jul 10 17:00:40 2007 UTC revision 47 by abate, Tue Jul 10 17:00:52 2007 UTC
# Line 335  Line 335 
335            let (fv,e) = expr e in            let (fv,e) = expr e in
336            (fv,  Typed.Dot (e,l))            (fv,  Typed.Dot (e,l))
337        | RecordLitt r ->        | RecordLitt r ->
           (* Note: quadratic check for non duplication of labels.  
              Should improve that to O(n log n) for dealing  
              with huge number of attributes ?  
           *)  
338            let fv = ref Fv.empty in            let fv = ref Fv.empty in
339            let labs = ref [] in            let r  = List.sort (fun (l1,_) (l2,_) -> compare l1 l2) r in
340            let r = List.map            let r = List.map
341                      (fun (l,e) ->                      (fun (l,e) ->
342                         let (fv2,e) = expr e in                         let (fv2,e) = expr e in fv := Fv.union !fv fv2; (l,e))
343                         if (List.mem l !labs) then                      r in
344                           raise_loc loc (MultipleLabel l);            let rec check = function
345                         labs := l :: !labs;              | (l1,_) :: (l2,_) :: _ when l1 = l2 ->
346                         fv := Fv.union !fv fv2;                  raise_loc loc (MultipleLabel l1)
347                         (l,e)              | _ :: rem -> check rem
348                      ) r in              | _ -> () in
349              check r;
350            (!fv, Typed.RecordLitt r)            (!fv, Typed.RecordLitt r)
351        | Op (op,le) ->        | Op (op,le) ->
352            let (fvs,ltes) = List.split (List.map expr le) in            let (fvs,ltes) = List.split (List.map expr le) in

Legend:
Removed from v.46  
changed lines
  Added in v.47

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5