aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-03-20 20:18:19 -0700
committerGraydon Hoare <[email protected]>2011-03-20 20:18:19 -0700
commit4b946cea35888bc82c624e9d79fade3077b40c3c (patch)
treef4a618c82541396930cd876ad938f81781f6422f /src/comp/front
parentSwitch win32 path_sep to '/', add comment explaining a bit. (diff)
downloadrust-4b946cea35888bc82c624e9d79fade3077b40c3c.tar.xz
rust-4b946cea35888bc82c624e9d79fade3077b40c3c.zip
Modify native_item_fn to handle trailing linkage names that differ from the item name (used in win32 build of std.dll)
Diffstat (limited to 'src/comp/front')
-rw-r--r--src/comp/front/ast.rs5
-rw-r--r--src/comp/front/parser.rs8
2 files changed, 10 insertions, 3 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index ec93db55..a007e76b 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -367,7 +367,8 @@ tag item_ {
type native_item = spanned[native_item_];
tag native_item_ {
native_item_ty(ident, def_id);
- native_item_fn(ident, fn_decl, vec[ty_param], def_id, ann);
+ native_item_fn(ident, option.t[str],
+ fn_decl, vec[ty_param], def_id, ann);
}
// TODO: Actually store something here.
@@ -426,7 +427,7 @@ fn index_native_item(native_mod_index index, @native_item it) {
case (ast.native_item_ty(?id, _)) {
index.insert(id, ast.nmie_item(it));
}
- case (ast.native_item_fn(?id, _, _, _, _)) {
+ case (ast.native_item_fn(?id, _, _, _, _, _)) {
index.insert(id, ast.nmie_item(it));
}
}
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index b00a2deb..9d3724f9 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -1859,9 +1859,15 @@ impure fn parse_item_native_fn(parser p, ast.effect eff) -> @ast.native_item {
expect(p, token.FN);
auto t = parse_fn_header(p);
auto decl = parse_fn_decl(p, eff);
+ auto link_name = none[str];
+ if (p.peek() == token.EQ) {
+ p.bump();
+ link_name = some[str](parse_str_lit_or_env_ident(p));
+ }
auto hi = p.get_span();
expect(p, token.SEMI);
- auto item = ast.native_item_fn(t._0, decl, t._1, p.next_def_id(),
+ auto item = ast.native_item_fn(t._0, link_name, decl,
+ t._1, p.next_def_id(),
ast.ann_none);
ret @spanned(lo, hi, item);
}