diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-09-04 16:40:11 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-09-04 16:41:19 -0700 |
| commit | 451da077188002f7db62051f973d1ee6069dd1dc (patch) | |
| tree | cb5ce613fdccf096201353c651a18be02c26bb40 /src/libsyntax | |
| parent | c491bf939ee715b8624000e5b6fb033acda26826 (diff) | |
Allow anonymous extern mods
Now you can write:
extern {
f() -> int;
}
and f will be accessible in the enclosing scope.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 4ea7156116b..c131c7d57ad 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -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, _) => { |
