Skip to content

Commit 213144a

Browse files
author
Rafael Avila de Espindola
committed
---
yaml --- r: 1343 b: refs/heads/master c: 8122e0c h: refs/heads/master i: 1341: fc7ae0a 1339: cc8ea38 1335: cd8e4e0 1327: 06c6375 1311: b8502fb 1279: 74f4be3 v: v3
1 parent cd485df commit 213144a

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 57bb9d809bb029caf7b38042a433153bb965e1fb
2+
refs/heads/master: 8122e0c54280545c28e8067c0e3a19253fe3aa9b

trunk/src/comp/front/parser.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,9 +1630,20 @@ impure fn parse_native_mod_items(parser p,
16301630
impure fn parse_item_native_mod(parser p) -> @ast.item {
16311631
auto lo = p.get_span();
16321632
expect(p, token.NATIVE);
1633-
auto native_name = parse_str_lit(p);
1633+
auto has_eq;
1634+
auto native_name = "";
1635+
if (p.peek() == token.MOD) {
1636+
has_eq = true;
1637+
} else {
1638+
native_name = parse_str_lit(p);
1639+
has_eq = false;
1640+
}
16341641
expect(p, token.MOD);
16351642
auto id = parse_ident(p);
1643+
if (has_eq) {
1644+
expect(p, token.EQ);
1645+
native_name = parse_str_lit(p);
1646+
}
16361647
expect(p, token.LBRACE);
16371648
auto m = parse_native_mod_items(p, native_name);
16381649
auto hi = p.get_span();

trunk/src/test/run-pass/native2.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@ native "rust" mod rustrt {
33
fn vec_buf[T](vec[T] v, uint offset) -> vbuf;
44
}
55

6+
native mod libc = "libc.dylib" {
7+
fn write(int fd, rustrt.vbuf buf, uint count) -> int;
8+
}
9+
610
fn main(vec[str] args) {
711
}

0 commit comments

Comments
 (0)