diff options
| author | Patrick Walton <[email protected]> | 2010-09-21 17:38:18 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-09-21 17:38:47 -0700 |
| commit | 742b1c57938137f5d9a6676d40affc0c39348321 (patch) | |
| tree | 5a8179dcd9e0bc231ebf0d2428b3fa39bc9eab36 /src/boot | |
| parent | Begin teaching rustc to parse literals, atoms, stmts, blocks, items, modules,... (diff) | |
| download | rust-742b1c57938137f5d9a6676d40affc0c39348321.tar.xz rust-742b1c57938137f5d9a6676d40affc0c39348321.zip | |
Report an error instead of asserting when an item name is already in use
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/fe/item.ml | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/boot/fe/item.ml b/src/boot/fe/item.ml index 14ef6951..5340d262 100644 --- a/src/boot/fe/item.ml +++ b/src/boot/fe/item.ml @@ -1240,9 +1240,13 @@ and parse_use [| (ident, item) |] and parse_item_decl ps items fn = - Array.iter - (fun (id,it) -> htab_put items id it) - (fn ps); + let add (id, item) = + if Hashtbl.mem items id then + raise (Parse_err + (ps, (Printf.sprintf "item name already in use: '%s'" id))); + Hashtbl.add items id item + in + Array.iter add (fn ps) and parse_mod_header (ps:pstate) : (Ast.mod_view * Ast.mod_items) = |