}
}
+// expand a method
+fn expand_method(m: &ast::Method, fld: &mut MacroExpander) -> Gc<ast::Method> {
+ let id = fld.new_id(m.id);
+ let (rewritten_fn_decl, rewritten_body)
+ = expand_and_rename_fn_decl_and_block(m.decl,m.body,fld);
+
+ // all of the other standard stuff:
+ box(GC) ast::Method {
+ id: id,
+ ident: fld.fold_ident(m.ident),
+ attrs: m.attrs.iter().map(|a| fld.fold_attribute(*a)).collect(),
+ generics: fold_generics(&m.generics, fld),
+ explicit_self: fld.fold_explicit_self(&m.explicit_self),
+ fn_style: m.fn_style,
+ decl: rewritten_fn_decl,
+ body: rewritten_body,
+ span: fld.new_span(m.span),
+ vis: m.vis
+ }
+}
+
/// Given a fn_decl and a block and a MacroExpander, expand the fn_decl, then use the
/// PatIdents in its arguments to perform renaming in the FnDecl and
/// the block, returning both the new FnDecl and the new Block.
expand_arm(arm, self)
}
+ fn fold_method(&mut self, method: Gc<ast::Method>) -> Gc<ast::Method> {
+ expand_method(method, self)
+ }
+
fn new_span(&mut self, span: Span) -> Span {
new_span(self.cx, span)
}