@@ -1285,7 +1285,7 @@ fn parse_if_expr(p: &parser) -> @ast::expr {
1285
1285
1286
1286
fn parse_fn_expr ( p : & parser , proto : ast:: proto ) -> @ast:: expr {
1287
1287
let lo = p. get_last_lo_pos ( ) ;
1288
- let decl = parse_fn_decl ( p, ast:: impure_fn) ;
1288
+ let decl = parse_fn_decl ( p, ast:: impure_fn, ast :: il_normal ) ;
1289
1289
let body = parse_block ( p) ;
1290
1290
let _fn = { decl: decl, proto: proto, body: body} ;
1291
1291
ret mk_expr( p, lo, body. span . hi , ast:: expr_fn ( _fn) ) ;
@@ -1706,7 +1706,8 @@ fn parse_ty_params(p: &parser) -> ast::ty_param[] {
1706
1706
ret ty_params;
1707
1707
}
1708
1708
1709
- fn parse_fn_decl ( p : & parser , purity : ast:: purity ) -> ast:: fn_decl {
1709
+ fn parse_fn_decl ( p : & parser , purity : ast:: purity , il : ast:: inlineness )
1710
+ -> ast:: fn_decl {
1710
1711
let inputs: ast:: spanned [ ast:: arg[ ] ] =
1711
1712
parse_seq ( token:: LPAREN , token:: RPAREN , some ( token:: COMMA ) , parse_arg,
1712
1713
p) ;
@@ -1730,23 +1731,24 @@ fn parse_fn_decl(p: &parser, purity: ast::purity) -> ast::fn_decl {
1730
1731
ret { inputs : inputs. node ,
1731
1732
output : t,
1732
1733
purity : purity,
1733
- il : ast :: il_normal ,
1734
+ il : il ,
1734
1735
cf : ast:: return,
1735
1736
constraints : constrs} ;
1736
1737
}
1737
1738
a_bang. {
1738
1739
ret { inputs : inputs. node ,
1739
1740
output : @spanned ( p. get_lo_pos ( ) , p. get_hi_pos ( ) , ast:: ty_bot) ,
1740
1741
purity : purity,
1741
- il : ast :: il_normal ,
1742
+ il : il ,
1742
1743
cf : ast:: noreturn,
1743
1744
constraints : constrs} ;
1744
1745
}
1745
1746
}
1746
1747
}
1747
1748
1748
- fn parse_fn ( p : & parser , proto : ast:: proto , purity : ast:: purity ) -> ast:: _fn {
1749
- let decl = parse_fn_decl ( p, purity) ;
1749
+ fn parse_fn ( p : & parser , proto : ast:: proto , purity : ast:: purity ,
1750
+ il : ast:: inlineness ) -> ast:: _fn {
1751
+ let decl = parse_fn_decl ( p, purity, il) ;
1750
1752
let body = parse_block ( p) ;
1751
1753
ret { decl : decl, proto : proto, body : body} ;
1752
1754
}
@@ -1767,10 +1769,11 @@ fn mk_item(p: &parser, lo: uint, hi: uint, ident: &ast::ident,
1767
1769
}
1768
1770
1769
1771
fn parse_item_fn_or_iter ( p : & parser , purity : ast:: purity , proto : ast:: proto ,
1770
- attrs : & ast:: attribute [ ] ) -> @ast:: item {
1772
+ attrs : & ast:: attribute [ ] , il : ast:: inlineness )
1773
+ -> @ast:: item {
1771
1774
let lo = p. get_last_lo_pos ( ) ;
1772
1775
let t = parse_fn_header ( p) ;
1773
- let f = parse_fn ( p, proto, purity) ;
1776
+ let f = parse_fn ( p, proto, purity, il ) ;
1774
1777
ret mk_item( p, lo, f. body . span . hi , t. ident , ast:: item_fn ( f, t. tps ) ,
1775
1778
attrs) ;
1776
1779
}
@@ -1797,7 +1800,7 @@ fn parse_method(p: &parser) -> @ast::method {
1797
1800
let lo = p. get_lo_pos ( ) ;
1798
1801
let proto = parse_proto ( p) ;
1799
1802
let ident = parse_value_ident ( p) ;
1800
- let f = parse_fn ( p, proto, ast:: impure_fn) ;
1803
+ let f = parse_fn ( p, proto, ast:: impure_fn, ast :: il_normal ) ;
1801
1804
let meth = { ident: ident, meth: f, id: p. get_id ( ) } ;
1802
1805
ret @spanned ( lo, f. body . span . hi , meth) ;
1803
1806
}
@@ -1910,7 +1913,7 @@ fn parse_item_native_fn(p: &parser, attrs: &ast::attribute[]) ->
1910
1913
@ast:: native_item {
1911
1914
let lo = p. get_last_lo_pos ( ) ;
1912
1915
let t = parse_fn_header ( p) ;
1913
- let decl = parse_fn_decl ( p, ast:: impure_fn) ;
1916
+ let decl = parse_fn_decl ( p, ast:: impure_fn, ast :: il_normal ) ;
1914
1917
let link_name = none;
1915
1918
if p. peek ( ) == token:: EQ { p. bump ( ) ; link_name = some ( parse_str ( p) ) ; }
1916
1919
let hi = p. get_hi_pos ( ) ;
@@ -2071,16 +2074,20 @@ fn parse_auth(p: &parser) -> ast::_auth {
2071
2074
fn parse_item ( p : & parser , attrs : & ast:: attribute [ ] ) -> option:: t[ @ast:: item ] {
2072
2075
if eat_word ( p, "const" ) {
2073
2076
ret some ( parse_item_const ( p, attrs) ) ;
2077
+ } else if ( eat_word ( p, "inline" ) ) {
2078
+ expect_word ( p, "fn" ) ;
2079
+ ret some( parse_item_fn_or_iter ( p, ast:: impure_fn, ast:: proto_fn,
2080
+ attrs, ast:: il_inline) ) ;
2074
2081
} else if ( is_word ( p, "fn" ) && p. look_ahead ( 1 u) != token:: LPAREN ) {
2075
2082
p. bump ( ) ;
2076
2083
ret some( parse_item_fn_or_iter ( p, ast:: impure_fn, ast:: proto_fn,
2077
- attrs) ) ;
2084
+ attrs, ast :: il_normal ) ) ;
2078
2085
} else if ( eat_word ( p, "pred" ) ) {
2079
2086
ret some ( parse_item_fn_or_iter ( p, ast:: pure_fn, ast:: proto_fn,
2080
- attrs) ) ;
2087
+ attrs, ast :: il_normal ) ) ;
2081
2088
} else if ( eat_word ( p, "iter" ) ) {
2082
2089
ret some ( parse_item_fn_or_iter ( p, ast:: impure_fn, ast:: proto_iter,
2083
- attrs) ) ;
2090
+ attrs, ast :: il_normal ) ) ;
2084
2091
} else if ( eat_word ( p, "mod" ) ) {
2085
2092
ret some ( parse_item_mod ( p, attrs) ) ;
2086
2093
} else if ( eat_word ( p, "native" ) ) {
0 commit comments