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

@ -7,7 +7,7 @@ import front::attr;
import syntax::visit;
import syntax::codemap::span;
import util::{filesearch};
import std::{vec, str, fs, io, option};
import std::{either, vec, str, fs, io, option};
import std::option::{none, some};
import std::map::{hashmap, new_int_hash};
import syntax::print::pprust;
@ -49,9 +49,12 @@ fn visit_view_item(e: env, i: @ast::view_item) {
fn visit_item(e: env, i: @ast::item) {
alt i.node {
ast::item_native_mod(m) {
if m.abi != ast::native_abi_cdecl &&
m.abi != ast::native_abi_stdcall {
ret;
alt attr::native_abi(i.attrs) {
either::right(abi) {
if abi != ast::native_abi_cdecl &&
abi != ast::native_abi_stdcall { ret; }
}
either::left(msg) { e.sess.span_fatal(i.span, msg); }
}
let cstore = e.sess.get_cstore();
let native_name = i.ident;

View file

@ -257,14 +257,8 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
func.cs);
}
'N' {
let abi;
alt next(st) as char {
'i' { abi = ast::native_abi_rust_intrinsic; }
'C' { abi = ast::native_abi_cdecl; }
'S' { abi = ast::native_abi_stdcall; }
}
let func = parse_ty_fn(st, sd);
ret ty::mk_native_fn(st.tcx, abi, func.args, func.ty);
ret ty::mk_native_fn(st.tcx, func.args, func.ty);
}
'O' {
assert (next(st) as char == '[');

View file

@ -138,13 +138,8 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
enc_proto(w, proto);
enc_ty_fn(w, cx, args, out, cf, constrs);
}
ty::ty_native_fn(abi, args, out) {
ty::ty_native_fn(args, out) {
w.write_char('N');
alt abi {
native_abi_rust_intrinsic. { w.write_char('i'); }
native_abi_cdecl. { w.write_char('C'); }
native_abi_stdcall. { w.write_char('S'); }
}
enc_ty_fn(w, cx, args, out, return_val, []);
}
ty::ty_obj(methods) {