| 22 |
|
|
| 23 |
type ti = { |
type ti = { |
| 24 |
id : int; |
id : int; |
| 25 |
|
mutable seen : bool; |
| 26 |
mutable loc' : loc; |
mutable loc' : loc; |
| 27 |
mutable fv : StringSet.t option; |
mutable fv : StringSet.t option; |
| 28 |
mutable descr': descr; |
mutable descr': descr; |
| 52 |
incr counter; |
incr counter; |
| 53 |
let rec x = { |
let rec x = { |
| 54 |
id = !counter; |
id = !counter; |
| 55 |
|
seen = false; |
| 56 |
loc' = loc; |
loc' = loc; |
| 57 |
fv = None; |
fv = None; |
| 58 |
descr' = `Alias ("__dummy__", x); |
descr' = `Alias ("__dummy__", x); |
| 275 |
module IntSet = |
module IntSet = |
| 276 |
Set.Make(struct type t = int let compare (x:int) y = compare x y end) |
Set.Make(struct type t = int let compare (x:int) y = compare x y end) |
| 277 |
|
|
| 278 |
let comp_fv_seen = ref IntSet.empty |
let comp_fv_seen = ref [] |
| 279 |
let comp_fv_res = ref StringSet.empty |
let comp_fv_res = ref StringSet.empty |
| 280 |
let rec comp_fv s = |
let rec comp_fv s = |
| 281 |
match s.fv with |
match s.fv with |
| 283 |
| None -> |
| None -> |
| 284 |
(match s.descr' with |
(match s.descr' with |
| 285 |
| `Alias (_,x) -> |
| `Alias (_,x) -> |
| 286 |
if IntSet.mem x.id !comp_fv_seen then () |
if x.seen then () |
| 287 |
else ( |
else ( |
| 288 |
comp_fv_seen := IntSet.add x.id !comp_fv_seen; |
x.seen <- true; |
| 289 |
|
comp_fv_seen := x :: !comp_fv_seen; |
| 290 |
comp_fv x |
comp_fv x |
| 291 |
) |
) |
| 292 |
| `Or (s1,s2) |
| `Or (s1,s2) |
| 308 |
comp_fv s; |
comp_fv s; |
| 309 |
let l = !comp_fv_res in |
let l = !comp_fv_res in |
| 310 |
comp_fv_res := StringSet.empty; |
comp_fv_res := StringSet.empty; |
| 311 |
comp_fv_seen := IntSet.empty; |
List.iter (fun n -> n.seen <- false) !comp_fv_seen; |
| 312 |
|
comp_fv_seen := []; |
| 313 |
s.fv <- Some l; |
s.fv <- Some l; |
| 314 |
l |
l |
| 315 |
|
|
| 343 |
let type_node s = |
let type_node s = |
| 344 |
let s = typ_node s in |
let s = typ_node s in |
| 345 |
let s = Types.internalize s in |
let s = Types.internalize s in |
| 346 |
(* Types.define s (Types.normalize (Types.descr s)); *) |
Types.define s (Types.normalize (Types.descr s)); |
| 347 |
s |
s |
| 348 |
|
|
| 349 |
let rec pat seen s : Patterns.descr = |
let rec pat seen s : Patterns.descr = |