diff options
| author | Graydon Hoare <[email protected]> | 2010-10-13 15:53:38 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-10-13 15:53:38 -0700 |
| commit | 52c2a1549c2dda91d147d20edd62f6465b90d9e4 (patch) | |
| tree | 00e93fcc2a7b2c348c2beaec5c85391943b6c089 /src/boot/me/semant.ml | |
| parent | Use "friendly" types throughout the typechecker (diff) | |
| download | rust-52c2a1549c2dda91d147d20edd62f6465b90d9e4.tar.xz rust-52c2a1549c2dda91d147d20edd62f6465b90d9e4.zip | |
Fetch typarams from the outermost item frame, when inside an iter-block. One less crash in rustc.
Diffstat (limited to 'src/boot/me/semant.ml')
| -rw-r--r-- | src/boot/me/semant.ml | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml index c8b3b45e..8ff439e8 100644 --- a/src/boot/me/semant.ml +++ b/src/boot/me/semant.ml @@ -495,12 +495,18 @@ let get_callsz (cx:ctxt) (id:node_id) : size = else bugi cx id "missing callsz" ;; +let get_loop_outermost_fn (cx:ctxt) (id:node_id) : node_id = + match Hashtbl.find cx.ctxt_all_defns id with + DEFN_loop_body fnid -> fnid + | _ -> bugi cx id "get_loop_outermost_fn on non-loop" +;; + let rec n_item_ty_params (cx:ctxt) (id:node_id) : int = match Hashtbl.find cx.ctxt_all_defns id with DEFN_item i -> Array.length i.Ast.decl_params | DEFN_obj_fn (oid,_) -> n_item_ty_params cx oid | DEFN_obj_drop oid -> n_item_ty_params cx oid - | DEFN_loop_body fid -> n_item_ty_params cx fid + | DEFN_loop_body _ -> 0 | _ -> bugi cx id "n_item_ty_params on non-item" ;; |