@@ -2227,11 +2227,17 @@ impl parser {
2227
2227
}
2228
2228
2229
2229
let lo = self . span . lo ;
2230
- let us = self . eat_keyword ( ~"unsafe ") ;
2231
- self . expect ( token:: LBRACE ) ;
2232
- let { inner, next} = maybe_parse_inner_attrs_and_next ( self ,
2233
- parse_attrs) ;
2234
- return ( inner, self . parse_block_tail_ ( lo, if us { unsafe_blk } else { default_blk } , next) ) ;
2230
+ if self . eat_keyword ( ~"unsafe ") {
2231
+ self . expect ( token:: LBRACE ) ;
2232
+ let { inner, next} = maybe_parse_inner_attrs_and_next ( self ,
2233
+ parse_attrs) ;
2234
+ return ( inner, self . parse_block_tail_ ( lo, unsafe_blk, next) ) ;
2235
+ } else {
2236
+ self . expect ( token:: LBRACE ) ;
2237
+ let { inner, next} = maybe_parse_inner_attrs_and_next ( self ,
2238
+ parse_attrs) ;
2239
+ return ( inner, self . parse_block_tail_ ( lo, default_blk, next) ) ;
2240
+ }
2235
2241
}
2236
2242
2237
2243
fn parse_block_no_value ( ) -> blk {
@@ -2934,7 +2940,8 @@ impl parser {
2934
2940
( id, item_mod ( m) , Some ( inner_attrs. inner ) )
2935
2941
}
2936
2942
2937
- fn parse_item_foreign_fn ( +attrs : ~[ attribute ] ) -> @foreign_item {
2943
+ fn parse_item_foreign_fn ( vis : ast:: visibility ,
2944
+ +attrs : ~[ attribute ] ) -> @foreign_item {
2938
2945
let lo = self . span . lo ;
2939
2946
let purity = self . parse_fn_purity ( ) ;
2940
2947
let t = self . parse_fn_header ( ) ;
@@ -2945,10 +2952,12 @@ impl parser {
2945
2952
attrs: attrs,
2946
2953
node: foreign_item_fn ( decl, purity, t. tps ) ,
2947
2954
id: self . get_id ( ) ,
2948
- span: mk_sp ( lo, hi) } ;
2955
+ span: mk_sp ( lo, hi) ,
2956
+ vis: vis} ;
2949
2957
}
2950
2958
2951
- fn parse_item_foreign_const ( +attrs : ~[ attribute ] ) -> @foreign_item {
2959
+ fn parse_item_foreign_const ( vis : ast:: visibility ,
2960
+ +attrs : ~[ attribute ] ) -> @foreign_item {
2952
2961
let lo = self . span . lo ;
2953
2962
self . expect_keyword ( ~"const ") ;
2954
2963
let ident = self . parse_ident ( ) ;
@@ -2960,7 +2969,8 @@ impl parser {
2960
2969
attrs: attrs,
2961
2970
node: foreign_item_const ( move ty) ,
2962
2971
id: self . get_id ( ) ,
2963
- span: mk_sp ( lo, hi) } ;
2972
+ span: mk_sp ( lo, hi) ,
2973
+ vis: vis} ;
2964
2974
}
2965
2975
2966
2976
fn parse_fn_purity ( ) -> purity {
@@ -2976,10 +2986,11 @@ impl parser {
2976
2986
}
2977
2987
2978
2988
fn parse_foreign_item ( +attrs : ~[ attribute ] ) -> @foreign_item {
2989
+ let vis = self . parse_visibility ( ) ;
2979
2990
if self . is_keyword ( ~"const ") {
2980
- self . parse_item_foreign_const ( move attrs)
2991
+ self . parse_item_foreign_const ( vis , move attrs)
2981
2992
} else {
2982
- self . parse_item_foreign_fn ( move attrs)
2993
+ self . parse_item_foreign_fn ( vis , move attrs)
2983
2994
}
2984
2995
}
2985
2996
0 commit comments