diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-03-27 15:39:48 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-03-31 15:47:36 -0700 |
| commit | 3c76f4ac8ddca0fb0809b00e3e448f57cf1931b7 (patch) | |
| tree | c00e4a730162f2b18c90971183ae28a746bbf4f8 /src/libsyntax/ext | |
| parent | c034d0c854b9e80dc5d20ebe152eee8ce96ed544 (diff) | |
| download | rust-3c76f4ac8ddca0fb0809b00e3e448f57cf1931b7.tar.gz rust-3c76f4ac8ddca0fb0809b00e3e448f57cf1931b7.zip | |
syntax: Switch field privacy as necessary
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 34 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/generic.rs | 48 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/ty.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 14 |
5 files changed, 60 insertions, 58 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 2bcb9c4a229..7ff77923132 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -30,8 +30,8 @@ use collections::HashMap; // ast::MacInvocTT. pub struct MacroDef { - name: ~str, - ext: SyntaxExtension + pub name: ~str, + pub ext: SyntaxExtension } pub type ItemDecorator = @@ -41,8 +41,8 @@ pub type ItemModifier = fn(&mut ExtCtxt, Span, @ast::MetaItem, @ast::Item) -> @ast::Item; pub struct BasicMacroExpander { - expander: MacroExpanderFn, - span: Option<Span> + pub expander: MacroExpanderFn, + pub span: Option<Span> } pub trait MacroExpander { @@ -68,8 +68,8 @@ impl MacroExpander for BasicMacroExpander { } pub struct BasicIdentMacroExpander { - expander: IdentMacroExpanderFn, - span: Option<Span> + pub expander: IdentMacroExpanderFn, + pub span: Option<Span> } pub trait IdentMacroExpander { @@ -172,9 +172,9 @@ pub enum SyntaxExtension { pub struct BlockInfo { // should macros escape from this scope? - macros_escape: bool, + pub macros_escape: bool, // what are the pending renames? - pending_renames: RenameList, + pub pending_renames: RenameList, } impl BlockInfo { @@ -292,8 +292,8 @@ pub fn syntax_expander_table() -> SyntaxEnv { } pub struct MacroCrate { - lib: Option<Path>, - cnum: ast::CrateNum, + pub lib: Option<Path>, + pub cnum: ast::CrateNum, } pub trait CrateLoader { @@ -306,13 +306,13 @@ pub trait CrateLoader { // when a macro expansion occurs, the resulting nodes have the backtrace() // -> expn_info of their expansion context stored into their span. pub struct ExtCtxt<'a> { - parse_sess: &'a parse::ParseSess, - cfg: ast::CrateConfig, - backtrace: Option<@ExpnInfo>, - ecfg: expand::ExpansionConfig<'a>, + pub parse_sess: &'a parse::ParseSess, + pub cfg: ast::CrateConfig, + pub backtrace: Option<@ExpnInfo>, + pub ecfg: expand::ExpansionConfig<'a>, - mod_path: Vec<ast::Ident> , - trace_mac: bool + pub mod_path: Vec<ast::Ident> , + pub trace_mac: bool, } impl<'a> ExtCtxt<'a> { @@ -532,7 +532,7 @@ struct MapChainFrame { // Only generic to make it easy to test pub struct SyntaxEnv { - priv chain: Vec<MapChainFrame> , + chain: Vec<MapChainFrame> , } impl SyntaxEnv { diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 63e9a466a8e..0d851647b3d 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -192,75 +192,77 @@ mod ty; pub struct TraitDef<'a> { /// The span for the current #[deriving(Foo)] header. - span: Span, + pub span: Span, - attributes: Vec<ast::Attribute> , + pub attributes: Vec<ast::Attribute>, /// Path of the trait, including any type parameters - path: Path<'a>, + pub path: Path<'a>, /// Additional bounds required of any type parameters of the type, /// other than the current trait - additional_bounds: Vec<Ty<'a>> , + pub additional_bounds: Vec<Ty<'a>>, /// Any extra lifetimes and/or bounds, e.g. `D: serialize::Decoder` - generics: LifetimeBounds<'a>, + pub generics: LifetimeBounds<'a>, - methods: Vec<MethodDef<'a>> } + pub methods: Vec<MethodDef<'a>>, +} pub struct MethodDef<'a> { /// name of the method - name: &'a str, + pub name: &'a str, /// List of generics, e.g. `R: rand::Rng` - generics: LifetimeBounds<'a>, + pub generics: LifetimeBounds<'a>, /// Whether there is a self argument (outer Option) i.e. whether /// this is a static function, and whether it is a pointer (inner /// Option) - explicit_self: Option<Option<PtrTy<'a>>>, + pub explicit_self: Option<Option<PtrTy<'a>>>, /// Arguments other than the self argument - args: Vec<Ty<'a>> , + pub args: Vec<Ty<'a>>, /// Return type - ret_ty: Ty<'a>, + pub ret_ty: Ty<'a>, /// Whether to mark this as #[inline] - inline: bool, + pub inline: bool, /// if the value of the nonmatching enums is independent of the /// actual enum variants, i.e. can use _ => .. match. - const_nonmatching: bool, + pub const_nonmatching: bool, - combine_substructure: CombineSubstructureFunc<'a> + pub combine_substructure: CombineSubstructureFunc<'a>, } /// All the data about the data structure/method being derived upon. pub struct Substructure<'a> { /// ident of self - type_ident: Ident, + pub type_ident: Ident, /// ident of the method - method_ident: Ident, + pub method_ident: Ident, /// dereferenced access to any Self or Ptr(Self, _) arguments - self_args: &'a [@Expr], + pub self_args: &'a [@Expr], /// verbatim access to any other arguments - nonself_args: &'a [@Expr], - fields: &'a SubstructureFields<'a> + pub nonself_args: &'a [@Expr], + pub fields: &'a SubstructureFields<'a> } /// Summary of the relevant parts of a struct/enum field. pub struct FieldInfo { - span: Span, + pub span: Span, /// None for tuple structs/normal enum variants, Some for normal /// structs/struct enum variants. - name: Option<Ident>, + pub name: Option<Ident>, /// The expression corresponding to this field of `self` /// (specifically, a reference to it). - self_: @Expr, + pub self_: @Expr, /// The expressions corresponding to references to this field in /// the other Self arguments. - other: Vec<@Expr> } + pub other: Vec<@Expr>, +} /// Fields for a static method pub enum StaticFields { diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index e58c024fcb0..c4ca2601f60 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -29,10 +29,10 @@ pub enum PtrTy<'a> { /// A path, e.g. `::std::option::Option::<int>` (global). Has support /// for type parameters and a lifetime. pub struct Path<'a> { - path: Vec<&'a str> , - lifetime: Option<&'a str>, - params: Vec<~Ty<'a>> , - global: bool + pub path: Vec<&'a str> , + pub lifetime: Option<&'a str>, + pub params: Vec<~Ty<'a>> , + pub global: bool, } impl<'a> Path<'a> { @@ -205,8 +205,8 @@ fn mk_generics(lifetimes: Vec<ast::Lifetime> , ty_params: Vec<ast::TyParam> ) - /// Lifetimes and bounds on type parameters pub struct LifetimeBounds<'a> { - lifetimes: Vec<&'a str>, - bounds: Vec<(&'a str, Vec<Path<'a>>)>, + pub lifetimes: Vec<&'a str>, + pub bounds: Vec<(&'a str, Vec<Path<'a>>)>, } impl<'a> LifetimeBounds<'a> { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index aa9330bf657..747ab583e79 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -838,8 +838,8 @@ pub fn new_span(cx: &ExtCtxt, sp: Span) -> Span { } pub struct MacroExpander<'a, 'b> { - extsbox: SyntaxEnv, - cx: &'a mut ExtCtxt<'b>, + pub extsbox: SyntaxEnv, + pub cx: &'a mut ExtCtxt<'b>, } impl<'a, 'b> Folder for MacroExpander<'a, 'b> { @@ -869,9 +869,9 @@ impl<'a, 'b> Folder for MacroExpander<'a, 'b> { } pub struct ExpansionConfig<'a> { - loader: &'a mut CrateLoader, - deriving_hash_type_parameter: bool, - crate_id: CrateId, + pub loader: &'a mut CrateLoader, + pub deriving_hash_type_parameter: bool, + pub crate_id: CrateId, } pub fn expand_crate(parse_sess: &parse::ParseSess, diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index bc8709befae..8fa4857cab0 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -31,16 +31,16 @@ struct TtFrame { #[deriving(Clone)] pub struct TtReader<'a> { - sp_diag: &'a SpanHandler, + pub sp_diag: &'a SpanHandler, // the unzipped tree: - priv stack: Vec<TtFrame>, + stack: Vec<TtFrame>, /* for MBE-style macro transcription */ - priv interpolations: HashMap<Ident, Rc<NamedMatch>>, - priv repeat_idx: Vec<uint>, - priv repeat_len: Vec<uint>, + interpolations: HashMap<Ident, Rc<NamedMatch>>, + repeat_idx: Vec<uint>, + repeat_len: Vec<uint>, /* cached: */ - cur_tok: Token, - cur_span: Span, + pub cur_tok: Token, + pub cur_span: Span, } /** This can do Macro-By-Example transcription. On the other hand, if |
