Allow anonymous extern mods

Now you can write:

extern {
  f() -> int;
}

and f will be accessible in the enclosing scope.
This commit is contained in:
Tim Chevalier
2012-09-04 16:40:11 -07:00
parent c491bf939e
commit 451da07718
4 changed files with 53 additions and 20 deletions

View File

@@ -239,7 +239,14 @@ fn map_item(i: @item, cx: ctx, v: vt) {
cx.map.insert(nitem.id,
node_foreign_item(nitem, abi,
/* FIXME (#2543) */
extend(cx, i.ident)));
if nm.sort == ast::named {
extend(cx, i.ident)
}
else {
/* Anonymous extern mods go
in the parent scope */
@copy cx.path
}));
}
}
item_class(struct_def, _) => {