Skip to content

Commit a54c802

Browse files
committed
---
yaml --- r: 123687 b: refs/heads/try c: e59dd48 h: refs/heads/master i: 123685: ff5b804 123683: 9f24dd7 123679: 7309e87 v: v3
1 parent 6bafc20 commit a54c802

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: da4e4e4e0a7778a85748aa4a303b13f603e96b4b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8ddd286ea4ba4384a0dc9eae393ed515460a986e
5-
refs/heads/try: 8f34b21375017aece4ae08fcf13f0dfcc8aca96e
5+
refs/heads/try: e59dd484c2cbdba5aca039f8895532599914d550
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libsyntax/ext/expand.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,27 @@ impl<'a> Folder for PatIdentRenamer<'a> {
934934
}
935935
}
936936

937+
// expand a method
938+
fn expand_method(m: &ast::Method, fld: &mut MacroExpander) -> Gc<ast::Method> {
939+
let id = fld.new_id(m.id);
940+
let (rewritten_fn_decl, rewritten_body)
941+
= expand_and_rename_fn_decl_and_block(m.decl,m.body,fld);
942+
943+
// all of the other standard stuff:
944+
box(GC) ast::Method {
945+
id: id,
946+
ident: fld.fold_ident(m.ident),
947+
attrs: m.attrs.iter().map(|a| fld.fold_attribute(*a)).collect(),
948+
generics: fold_generics(&m.generics, fld),
949+
explicit_self: fld.fold_explicit_self(&m.explicit_self),
950+
fn_style: m.fn_style,
951+
decl: rewritten_fn_decl,
952+
body: rewritten_body,
953+
span: fld.new_span(m.span),
954+
vis: m.vis
955+
}
956+
}
957+
937958
/// Given a fn_decl and a block and a MacroExpander, expand the fn_decl, then use the
938959
/// PatIdents in its arguments to perform renaming in the FnDecl and
939960
/// the block, returning both the new FnDecl and the new Block.
@@ -988,6 +1009,10 @@ impl<'a, 'b> Folder for MacroExpander<'a, 'b> {
9881009
expand_arm(arm, self)
9891010
}
9901011

1012+
fn fold_method(&mut self, method: Gc<ast::Method>) -> Gc<ast::Method> {
1013+
expand_method(method, self)
1014+
}
1015+
9911016
fn new_span(&mut self, span: Span) -> Span {
9921017
new_span(self.cx, span)
9931018
}

0 commit comments

Comments
 (0)