diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-01-15 17:23:59 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-01-15 17:48:58 -0800 |
| commit | 3466c9b4befd03fd39b099466b97fea92bb5109f (patch) | |
| tree | 77c3918572db83a837878cdd5af428b3a12e7dec /src/comp/syntax/print | |
| parent | 17585cc47ec7c4ffc9d14f33473c4238b6680e88 (diff) | |
| download | rust-3466c9b4befd03fd39b099466b97fea92bb5109f.tar.gz rust-3466c9b4befd03fd39b099466b97fea92bb5109f.zip | |
rustc: Parse fn inner attributes. Closes #1506
Diffstat (limited to 'src/comp/syntax/print')
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index ea2404e849c..e0c1acc4fcc 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -366,7 +366,7 @@ fn print_item(s: ps, &&item: @ast::item) { ast::item_fn(decl, typarams, body) { print_fn(s, decl, item.ident, typarams); word(s.s, " "); - print_block(s, body); + print_block_with_attrs(s, body, item.attrs); } ast::item_mod(_mod) { head(s, "mod"); @@ -551,10 +551,20 @@ fn print_block(s: ps, blk: ast::blk) { print_possibly_embedded_block(s, blk, block_normal, indent_unit); } +fn print_block_with_attrs(s: ps, blk: ast::blk, attrs: [ast::attribute]) { + print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs); +} + tag embed_type { block_macro; block_block_fn; block_normal; } fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type, indented: uint) { + print_possibly_embedded_block_( + s, blk, embedded, indented, []); +} + +fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type, + indented: uint, attrs: [ast::attribute]) { alt blk.node.rules { ast::unchecked_blk. { word(s.s, "unchecked"); } ast::unsafe_blk. { word(s.s, "unsafe"); } @@ -570,6 +580,8 @@ fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type, block_normal. { bopen(s); } } + print_inner_attributes(s, attrs); + for vi in blk.node.view_items { print_view_item(s, vi); } for st: @ast::stmt in blk.node.stmts { print_stmt(s, *st); |
