Changeset 3023:604e19595093
- Timestamp:
- 02/20/12 15:57:55 (3 months ago)
- Author:
- Etienne Millon <etienne . millon AT eads . net>
- Branch:
- default
- Message:
-
ptrtype: introduce type schemes
- Location:
- src/ptrtype
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r3021
|
r3023
|
|
| 312 | 312 | ; T.args = extract_types fdec.T.args |
| 313 | 313 | ; T.position = fdec.T.position |
| 314 | | ; T.fdectype = te |
| | 314 | ; T.fdectype = T.Forall ([], te) |
| 315 | 315 | } |
| 316 | 316 | in |
-
|
r3021
|
r3023
|
|
| 104 | 104 | ; T.body = c_blk f.N.body |
| 105 | 105 | ; T.position = f.N.position |
| 106 | | ; T.fdectype = nil_ty |
| | 106 | ; T.fdectype = T.Forall ([], nil_ty) |
| 107 | 107 | } |
| 108 | 108 | in |
-
|
r3022
|
r3023
|
|
| 43 | 43 | body : 'ty blk; |
| 44 | 44 | position: Newspeak.location; |
| 45 | | fdectype : 'ty; |
| | 45 | fdectype : 'ty scheme; |
| 46 | 46 | } |
| | 47 | |
| | 48 | and 'ty scheme = Forall of int list * 'ty |
| 47 | 49 | |
| 48 | 50 | and 'ty globals = (string, 'ty) Hashtbl.t |
| … |
… |
|
| 332 | 334 | Buffer.contents buf |
| 333 | 335 | |
| | 336 | let string_of_scheme sty (Forall (bv, t)) = |
| | 337 | let s_forall = |
| | 338 | if bv == [] then |
| | 339 | "" |
| | 340 | else |
| | 341 | String.concat " " (List.map string_of_int bv) ^ " . " |
| | 342 | in |
| | 343 | s_forall ^ sty t |
| | 344 | |
| | 345 | |
| 334 | 346 | let string_of_fundec sty name declaration = |
| 335 | 347 | Printf.sprintf |
| 336 | 348 | "%s : %s\n%s %s%s%s {\n%s}\n" |
| 337 | 349 | name |
| 338 | | (sty declaration.fdectype) |
| | 350 | (string_of_scheme sty declaration.fdectype) |
| 339 | 351 | (string_of_ret sty declaration.rets) |
| 340 | 352 | (string_of_loc_as_prefix declaration.position) |
-
|
r3021
|
r3023
|
|
| 76 | 76 | body : 'ty blk; |
| 77 | 77 | position: Newspeak.location; |
| 78 | | fdectype : 'ty; |
| | 78 | fdectype : 'ty scheme; |
| 79 | 79 | } |
| | 80 | |
| | 81 | and 'ty scheme = Forall of int list * 'ty |
| 80 | 82 | |
| 81 | 83 | and 'ty globals = (string, 'ty) Hashtbl.t |