rustc: Remove abi from ast::native_mod

This commit is contained in:
Haitao Li 2011-11-21 02:15:40 +08:00 committed by Marijn Haverbeke
parent 7a7f0604f4
commit 5ca83553bc
16 changed files with 126 additions and 128 deletions

View file

@ -431,9 +431,7 @@ tag native_abi {
}
type native_mod =
{// FIXME: Removing abi from AST. Depends on Issue #1179.
abi: native_abi,
view_items: [@view_item],
{view_items: [@view_item],
items: [@native_item]};
type variant_arg = {ty: @ty, id: node_id};

View file

@ -452,8 +452,7 @@ fn noop_fold_mod(m: _mod, fld: ast_fold) -> _mod {
}
fn noop_fold_native_mod(nm: native_mod, fld: ast_fold) -> native_mod {
ret {abi: nm.abi,
view_items: vec::map(fld.fold_view_item, nm.view_items),
ret {view_items: vec::map(fld.fold_view_item, nm.view_items),
items: vec::map(fld.fold_native_item, nm.items)}
}

View file

@ -1981,8 +1981,7 @@ fn parse_native_item(p: parser, attrs: [ast::attribute]) ->
} else { unexpected(p, p.peek()); }
}
fn parse_native_mod_items(p: parser, abi: ast::native_abi,
first_item_attrs: [ast::attribute]) ->
fn parse_native_mod_items(p: parser, first_item_attrs: [ast::attribute]) ->
ast::native_mod {
// Shouldn't be any view items since we've already parsed an item attr
let view_items =
@ -1996,8 +1995,7 @@ fn parse_native_mod_items(p: parser, abi: ast::native_abi,
initial_attrs = [];
items += [parse_native_item(p, attrs)];
}
ret {abi: abi,
view_items: view_items,
ret {view_items: view_items,
items: items};
}
@ -2009,24 +2007,7 @@ fn parse_item_native_mod(p: parser, attrs: [ast::attribute]) -> @ast::item {
let more_attrs = parse_inner_attrs_and_next(p);
let inner_attrs = more_attrs.inner;
let first_item_outer_attrs = more_attrs.next;
let abi =
alt attr::get_meta_item_value_str_by_name(
attrs + inner_attrs, "abi") {
none. { ast::native_abi_cdecl }
some("rust-intrinsic") {
ast::native_abi_rust_intrinsic
}
some("cdecl") {
ast::native_abi_cdecl
}
some("stdcall") {
ast::native_abi_stdcall
}
some(t) {
p.fatal("unsupported abi: " + t);
}
};
let m = parse_native_mod_items(p, abi, first_item_outer_attrs);
let m = parse_native_mod_items(p, first_item_outer_attrs);
let hi = p.get_hi_pos();
expect(p, token::RBRACE);
ret mk_item(p, lo, hi, id, ast::item_native_mod(m), attrs + inner_attrs);