Skip to content

Commit

Permalink
rename one of the two confusing MacroExpanders
Browse files Browse the repository at this point in the history
There were two things named MacroExpander, which was confusing. I renamed
one of them TTMacroExpander.

[breaking change]
  • Loading branch information
jbclements committed Jul 11, 2014
1 parent 3f3291e commit 50d9965
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/libsyntax/ext/base.rs
Expand Up @@ -48,7 +48,8 @@ pub struct BasicMacroExpander {
pub span: Option<Span>
}

pub trait MacroExpander {
/// Represents a thing that maps token trees to Macro Results
pub trait TTMacroExpander {
fn expand(&self,
ecx: &mut ExtCtxt,
span: Span,
Expand All @@ -60,7 +61,7 @@ pub type MacroExpanderFn =
fn(ecx: &mut ExtCtxt, span: codemap::Span, token_tree: &[ast::TokenTree])
-> Box<MacResult>;

impl MacroExpander for BasicMacroExpander {
impl TTMacroExpander for BasicMacroExpander {
fn expand(&self,
ecx: &mut ExtCtxt,
span: Span,
Expand Down Expand Up @@ -259,7 +260,7 @@ pub enum SyntaxExtension {
/// A normal, function-like syntax extension.
///
/// `bytes!` is a `NormalTT`.
NormalTT(Box<MacroExpander + 'static>, Option<Span>),
NormalTT(Box<TTMacroExpander + 'static>, Option<Span>),

/// A function-like syntax extension that has an extra ident before
/// the block.
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/ext/tt/macro_rules.rs
Expand Up @@ -13,7 +13,7 @@ use ast::{TTDelim};
use ast;
use codemap::{Span, Spanned, DUMMY_SP};
use ext::base::{ExtCtxt, MacResult, MacroDef};
use ext::base::{NormalTT, MacroExpander};
use ext::base::{NormalTT, TTMacroExpander};
use ext::base;
use ext::tt::macro_parser::{Success, Error, Failure};
use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal};
Expand Down Expand Up @@ -95,7 +95,7 @@ struct MacroRulesMacroExpander {
rhses: Vec<Rc<NamedMatch>>,
}

impl MacroExpander for MacroRulesMacroExpander {
impl TTMacroExpander for MacroRulesMacroExpander {
fn expand(&self,
cx: &mut ExtCtxt,
sp: Span,
Expand Down

0 comments on commit 50d9965

Please sign in to comment.