diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-03-15 00:22:48 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-03-29 11:17:59 +0000 |
| commit | f08d5ad4c59ca5fc1c961a94c53807d70959c375 (patch) | |
| tree | 4f617f1b1ea1e1e442d54d4e8ef10e9f5fde8b15 /src/libsyntax_ext | |
| parent | ec7c0aece17c9a11bc2eca15b994355a161bf878 (diff) | |
| download | rust-f08d5ad4c59ca5fc1c961a94c53807d70959c375.tar.gz rust-f08d5ad4c59ca5fc1c961a94c53807d70959c375.zip | |
Refactor how spans are combined in the parser.
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/format.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index aeb5b1e0a53..6f5ab50b2fe 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -559,11 +559,7 @@ impl<'a, 'b> Context<'a, 'b> { let name = self.ecx.ident_of(&format!("__arg{}", i)); pats.push(self.ecx.pat_ident(DUMMY_SP, name)); for ref arg_ty in self.arg_unique_types[i].iter() { - locals.push(Context::format_arg(self.ecx, - self.macsp, - e.span, - arg_ty, - self.ecx.expr_ident(e.span, name))); + locals.push(Context::format_arg(self.ecx, self.macsp, e.span, arg_ty, name)); } heads.push(self.ecx.expr_addr_of(e.span, e)); } @@ -576,11 +572,7 @@ impl<'a, 'b> Context<'a, 'b> { Exact(i) => spans_pos[i], _ => panic!("should never happen"), }; - counts.push(Context::format_arg(self.ecx, - self.macsp, - span, - &Count, - self.ecx.expr_ident(span, name))); + counts.push(Context::format_arg(self.ecx, self.macsp, span, &Count, name)); } // Now create a vector containing all the arguments @@ -643,9 +635,10 @@ impl<'a, 'b> Context<'a, 'b> { macsp: Span, mut sp: Span, ty: &ArgumentType, - arg: P<ast::Expr>) + arg: ast::Ident) -> P<ast::Expr> { sp.ctxt = sp.ctxt.apply_mark(ecx.current_expansion.mark); + let arg = ecx.expr_ident(sp, arg); let trait_ = match *ty { Placeholder(ref tyname) => { match &tyname[..] { |
