syntax: Switch field privacy as necessary

This commit is contained in:
Alex Crichton 2014-03-27 15:39:48 -07:00
parent c034d0c854
commit 3c76f4ac8d
24 changed files with 297 additions and 297 deletions

View File

@ -67,7 +67,7 @@ pub enum AbiArchitecture {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct AbiSet {
priv bits: u32 // each bit represents one of the abis below
bits: u32 // each bit represents one of the abis below
}
static AbiDatas: &'static [AbiData] = &[

View File

@ -40,8 +40,8 @@ pub fn P<T: 'static>(value: T) -> P<T> {
// That Work Together"
#[deriving(Clone, Hash, Ord, TotalEq, TotalOrd, Show)]
pub struct Ident {
name: Name,
ctxt: SyntaxContext
pub name: Name,
pub ctxt: SyntaxContext
}
impl Ident {
@ -115,9 +115,9 @@ pub type FnIdent = Option<Ident>;
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Lifetime {
id: NodeId,
span: Span,
name: Name
pub id: NodeId,
pub span: Span,
pub name: Name
}
// a "Path" is essentially Rust's notion of a name;
@ -126,12 +126,12 @@ pub struct Lifetime {
// of supporting information.
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Path {
span: Span,
pub span: Span,
/// A `::foo` path, is relative to the crate root rather than current
/// module (like paths in an import).
global: bool,
pub global: bool,
/// The segments in the path: the things separated by `::`.
segments: Vec<PathSegment> ,
pub segments: Vec<PathSegment> ,
}
/// A segment of a path: an identifier, an optional lifetime, and a set of
@ -139,11 +139,11 @@ pub struct Path {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct PathSegment {
/// The identifier portion of this path segment.
identifier: Ident,
pub identifier: Ident,
/// The lifetime parameters for this path segment.
lifetimes: Vec<Lifetime>,
pub lifetimes: Vec<Lifetime>,
/// The type parameters for this path segment, if present.
types: OwnedSlice<P<Ty>>,
pub types: OwnedSlice<P<Ty>>,
}
pub type CrateNum = u32;
@ -152,8 +152,8 @@ pub type NodeId = u32;
#[deriving(Clone, TotalEq, TotalOrd, Ord, Eq, Encodable, Decodable, Hash, Show)]
pub struct DefId {
krate: CrateNum,
node: NodeId,
pub krate: CrateNum,
pub node: NodeId,
}
/// Item definitions in the currently-compiled crate would have the CrateNum
@ -178,16 +178,16 @@ pub enum TyParamBound {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct TyParam {
ident: Ident,
id: NodeId,
bounds: OwnedSlice<TyParamBound>,
default: Option<P<Ty>>
pub ident: Ident,
pub id: NodeId,
pub bounds: OwnedSlice<TyParamBound>,
pub default: Option<P<Ty>>
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Generics {
lifetimes: Vec<Lifetime>,
ty_params: OwnedSlice<TyParam>,
pub lifetimes: Vec<Lifetime>,
pub ty_params: OwnedSlice<TyParam>,
}
impl Generics {
@ -259,10 +259,10 @@ pub type CrateConfig = Vec<@MetaItem> ;
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Crate {
module: Mod,
attrs: Vec<Attribute> ,
config: CrateConfig,
span: Span,
pub module: Mod,
pub attrs: Vec<Attribute>,
pub config: CrateConfig,
pub span: Span,
}
pub type MetaItem = Spanned<MetaItem_>;
@ -301,25 +301,25 @@ impl Eq for MetaItem_ {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Block {
view_items: Vec<ViewItem> ,
stmts: Vec<@Stmt> ,
expr: Option<@Expr>,
id: NodeId,
rules: BlockCheckMode,
span: Span,
pub view_items: Vec<ViewItem>,
pub stmts: Vec<@Stmt>,
pub expr: Option<@Expr>,
pub id: NodeId,
pub rules: BlockCheckMode,
pub span: Span,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Pat {
id: NodeId,
node: Pat_,
span: Span,
pub id: NodeId,
pub node: Pat_,
pub span: Span,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct FieldPat {
ident: Ident,
pat: @Pat,
pub ident: Ident,
pub pat: @Pat,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@ -436,11 +436,11 @@ pub enum Stmt_ {
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Local {
ty: P<Ty>,
pat: @Pat,
init: Option<@Expr>,
id: NodeId,
span: Span,
pub ty: P<Ty>,
pub pat: @Pat,
pub init: Option<@Expr>,
pub id: NodeId,
pub span: Span,
}
pub type Decl = Spanned<Decl_>;
@ -455,16 +455,16 @@ pub enum Decl_ {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Arm {
pats: Vec<@Pat> ,
guard: Option<@Expr>,
body: @Expr,
pub pats: Vec<@Pat>,
pub guard: Option<@Expr>,
pub body: @Expr,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Field {
ident: SpannedIdent,
expr: @Expr,
span: Span,
pub ident: SpannedIdent,
pub expr: @Expr,
pub span: Span,
}
pub type SpannedIdent = Spanned<Ident>;
@ -483,9 +483,9 @@ pub enum UnsafeSource {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Expr {
id: NodeId,
node: Expr_,
span: Span,
pub id: NodeId,
pub node: Expr_,
pub span: Span,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@ -681,27 +681,27 @@ pub enum Lit_ {
// type structure in middle/ty.rs as well.
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct MutTy {
ty: P<Ty>,
mutbl: Mutability,
pub ty: P<Ty>,
pub mutbl: Mutability,
}
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct TypeField {
ident: Ident,
mt: MutTy,
span: Span,
pub ident: Ident,
pub mt: MutTy,
pub span: Span,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct TypeMethod {
ident: Ident,
attrs: Vec<Attribute> ,
purity: Purity,
decl: P<FnDecl>,
generics: Generics,
explicit_self: ExplicitSelf,
id: NodeId,
span: Span,
pub ident: Ident,
pub attrs: Vec<Attribute>,
pub purity: Purity,
pub decl: P<FnDecl>,
pub generics: Generics,
pub explicit_self: ExplicitSelf,
pub id: NodeId,
pub span: Span,
}
// A trait method is either required (meaning it doesn't have an
@ -758,9 +758,9 @@ impl fmt::Show for FloatTy {
// NB Eq method appears below.
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Ty {
id: NodeId,
node: Ty_,
span: Span,
pub id: NodeId,
pub node: Ty_,
pub span: Span,
}
// Not represented directly in the AST, referred to by name through a ty_path.
@ -791,25 +791,25 @@ impl fmt::Show for Onceness {
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct ClosureTy {
sigil: Sigil,
region: Option<Lifetime>,
lifetimes: Vec<Lifetime>,
purity: Purity,
onceness: Onceness,
decl: P<FnDecl>,
pub sigil: Sigil,
pub region: Option<Lifetime>,
pub lifetimes: Vec<Lifetime>,
pub purity: Purity,
pub onceness: Onceness,
pub decl: P<FnDecl>,
// Optional optvec distinguishes between "fn()" and "fn:()" so we can
// implement issue #7264. None means "fn()", which means infer a default
// bound based on pointer sigil during typeck. Some(Empty) means "fn:()",
// which means use no bounds (e.g., not even Owned on a ~fn()).
bounds: Option<OwnedSlice<TyParamBound>>,
pub bounds: Option<OwnedSlice<TyParamBound>>,
}
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct BareFnTy {
purity: Purity,
abis: AbiSet,
lifetimes: Vec<Lifetime>,
decl: P<FnDecl>
pub purity: Purity,
pub abis: AbiSet,
pub lifetimes: Vec<Lifetime>,
pub decl: P<FnDecl>
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@ -840,21 +840,21 @@ pub enum AsmDialect {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct InlineAsm {
asm: InternedString,
asm_str_style: StrStyle,
clobbers: InternedString,
inputs: Vec<(InternedString, @Expr)> ,
outputs: Vec<(InternedString, @Expr)> ,
volatile: bool,
alignstack: bool,
dialect: AsmDialect
pub asm: InternedString,
pub asm_str_style: StrStyle,
pub clobbers: InternedString,
pub inputs: Vec<(InternedString, @Expr)>,
pub outputs: Vec<(InternedString, @Expr)>,
pub volatile: bool,
pub alignstack: bool,
pub dialect: AsmDialect
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Arg {
ty: P<Ty>,
pat: @Pat,
id: NodeId,
pub ty: P<Ty>,
pub pat: @Pat,
pub id: NodeId,
}
impl Arg {
@ -879,10 +879,10 @@ impl Arg {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct FnDecl {
inputs: Vec<Arg> ,
output: P<Ty>,
cf: RetStyle,
variadic: bool
pub inputs: Vec<Arg>,
pub output: P<Ty>,
pub cf: RetStyle,
pub variadic: bool
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@ -921,64 +921,64 @@ pub type ExplicitSelf = Spanned<ExplicitSelf_>;
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Method {
ident: Ident,
attrs: Vec<Attribute> ,
generics: Generics,
explicit_self: ExplicitSelf,
purity: Purity,
decl: P<FnDecl>,
body: P<Block>,
id: NodeId,
span: Span,
vis: Visibility,
pub ident: Ident,
pub attrs: Vec<Attribute>,
pub generics: Generics,
pub explicit_self: ExplicitSelf,
pub purity: Purity,
pub decl: P<FnDecl>,
pub body: P<Block>,
pub id: NodeId,
pub span: Span,
pub vis: Visibility,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Mod {
view_items: Vec<ViewItem> ,
items: Vec<@Item> ,
pub view_items: Vec<ViewItem> ,
pub items: Vec<@Item> ,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct ForeignMod {
abis: AbiSet,
view_items: Vec<ViewItem> ,
items: Vec<@ForeignItem> ,
pub abis: AbiSet,
pub view_items: Vec<ViewItem>,
pub items: Vec<@ForeignItem>,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct VariantArg {
ty: P<Ty>,
id: NodeId,
pub ty: P<Ty>,
pub id: NodeId,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub enum VariantKind {
TupleVariantKind(Vec<VariantArg> ),
TupleVariantKind(Vec<VariantArg>),
StructVariantKind(@StructDef),
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct EnumDef {
variants: Vec<P<Variant>> ,
pub variants: Vec<P<Variant>>,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Variant_ {
name: Ident,
attrs: Vec<Attribute> ,
kind: VariantKind,
id: NodeId,
disr_expr: Option<@Expr>,
vis: Visibility,
pub name: Ident,
pub attrs: Vec<Attribute>,
pub kind: VariantKind,
pub id: NodeId,
pub disr_expr: Option<@Expr>,
pub vis: Visibility,
}
pub type Variant = Spanned<Variant_>;
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct PathListIdent_ {
name: Ident,
id: NodeId,
pub name: Ident,
pub id: NodeId,
}
pub type PathListIdent = Spanned<PathListIdent_>;
@ -1004,10 +1004,10 @@ pub enum ViewPath_ {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct ViewItem {
node: ViewItem_,
attrs: Vec<Attribute> ,
vis: Visibility,
span: Span,
pub node: ViewItem_,
pub attrs: Vec<Attribute>,
pub vis: Visibility,
pub span: Span,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@ -1035,9 +1035,9 @@ pub enum AttrStyle {
// doc-comments are promoted to attributes that have is_sugared_doc = true
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Attribute_ {
style: AttrStyle,
value: @MetaItem,
is_sugared_doc: bool,
pub style: AttrStyle,
pub value: @MetaItem,
pub is_sugared_doc: bool,
}
/*
@ -1049,8 +1049,8 @@ pub struct Attribute_ {
*/
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct TraitRef {
path: Path,
ref_id: NodeId,
pub path: Path,
pub ref_id: NodeId,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@ -1071,10 +1071,10 @@ impl Visibility {
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct StructField_ {
kind: StructFieldKind,
id: NodeId,
ty: P<Ty>,
attrs: Vec<Attribute> ,
pub kind: StructFieldKind,
pub id: NodeId,
pub ty: P<Ty>,
pub attrs: Vec<Attribute>,
}
pub type StructField = Spanned<StructField_>;
@ -1096,10 +1096,10 @@ impl StructFieldKind {
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct StructDef {
fields: Vec<StructField> , /* fields, not including ctor */
pub fields: Vec<StructField>, /* fields, not including ctor */
/* ID of the constructor. This is only used for tuple- or enum-like
* structs. */
ctor_id: Option<NodeId>
pub ctor_id: Option<NodeId>
}
/*
@ -1108,12 +1108,12 @@ pub struct StructDef {
*/
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Item {
ident: Ident,
attrs: Vec<Attribute> ,
id: NodeId,
node: Item_,
vis: Visibility,
span: Span,
pub ident: Ident,
pub attrs: Vec<Attribute>,
pub id: NodeId,
pub node: Item_,
pub vis: Visibility,
pub span: Span,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
@ -1136,12 +1136,12 @@ pub enum Item_ {
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct ForeignItem {
ident: Ident,
attrs: Vec<Attribute> ,
node: ForeignItem_,
id: NodeId,
span: Span,
vis: Visibility,
pub ident: Ident,
pub attrs: Vec<Attribute>,
pub node: ForeignItem_,
pub id: NodeId,
pub span: Span,
pub vis: Visibility,
}
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]

View File

@ -184,7 +184,7 @@ pub struct Map {
///
/// Also, indexing is pretty quick when you've got a vector and
/// plain old integers.
priv map: RefCell<Vec<MapEntry> >
map: RefCell<Vec<MapEntry> >
}
impl Map {

View File

@ -325,8 +325,8 @@ pub fn empty_generics() -> Generics {
#[deriving(Encodable, Decodable)]
pub struct IdRange {
min: NodeId,
max: NodeId,
pub min: NodeId,
pub max: NodeId,
}
impl IdRange {
@ -352,9 +352,9 @@ pub trait IdVisitingOperation {
}
pub struct IdVisitor<'a, O> {
operation: &'a O,
pass_through_items: bool,
visited_outermost: bool,
pub operation: &'a O,
pub pass_through_items: bool,
pub visited_outermost: bool,
}
impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> {

View File

@ -337,8 +337,8 @@ pub fn test_cfg<AM: AttrMetaMethods, It: Iterator<AM>>
/// Represents the #[deprecated="foo"] (etc) attributes.
pub struct Stability {
level: StabilityLevel,
text: Option<InternedString>
pub level: StabilityLevel,
pub text: Option<InternedString>
}
/// The available stability levels.

View File

@ -86,19 +86,19 @@ to the original source.
*/
#[deriving(Clone, Show, Hash)]
pub struct Span {
lo: BytePos,
hi: BytePos,
pub lo: BytePos,
pub hi: BytePos,
/// Information about where the macro came from, if this piece of
/// code was created by a macro expansion.
expn_info: Option<@ExpnInfo>
pub expn_info: Option<@ExpnInfo>
}
pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None };
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct Spanned<T> {
node: T,
span: Span,
pub node: T,
pub span: Span,
}
impl Eq for Span {
@ -143,26 +143,26 @@ pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
/// A source code location used for error reporting
pub struct Loc {
/// Information about the original source
file: Rc<FileMap>,
pub file: Rc<FileMap>,
/// The (1-based) line number
line: uint,
pub line: uint,
/// The (0-based) column offset
col: CharPos
pub col: CharPos
}
/// A source code location used as the result of lookup_char_pos_adj
// Actually, *none* of the clients use the filename *or* file field;
// perhaps they should just be removed.
pub struct LocWithOpt {
filename: FileName,
line: uint,
col: CharPos,
file: Option<Rc<FileMap>>,
pub filename: FileName,
pub line: uint,
pub col: CharPos,
pub file: Option<Rc<FileMap>>,
}
// used to be structural records. Better names, anyone?
pub struct FileMapAndLine {fm: Rc<FileMap>, line: uint}
pub struct FileMapAndBytePos {fm: Rc<FileMap>, pos: BytePos}
pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: uint }
pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
/// The syntax with which a macro was invoked.
#[deriving(Clone, Hash, Show)]
@ -177,13 +177,13 @@ pub enum MacroFormat {
pub struct NameAndSpan {
/// The name of the macro that was invoked to create the thing
/// with this Span.
name: ~str,
pub name: ~str,
/// The format with which the macro was invoked.
format: MacroFormat,
pub format: MacroFormat,
/// The span of the macro definition itself. The macro may not
/// have a sensible definition span (e.g. something defined
/// completely inside libsyntax) in which case this is None.
span: Option<Span>
pub span: Option<Span>
}
/// Extra information for tracking macro expansion of spans
@ -198,29 +198,29 @@ pub struct ExpnInfo {
/// the expansion would point to the `bar!` invocation; that
/// call_site span would have its own ExpnInfo, with the call_site
/// pointing to the `foo!` invocation.
call_site: Span,
pub call_site: Span,
/// Information about the macro and its definition.
///
/// The `callee` of the inner expression in the `call_site`
/// example would point to the `macro_rules! bar { ... }` and that
/// of the `bar!()` invocation would point to the `macro_rules!
/// foo { ... }`.
callee: NameAndSpan
pub callee: NameAndSpan
}
pub type FileName = ~str;
pub struct FileLines {
file: Rc<FileMap>,
lines: Vec<uint>
pub file: Rc<FileMap>,
pub lines: Vec<uint>
}
/// Identifies an offset of a multi-byte character in a FileMap
pub struct MultiByteChar {
/// The absolute offset of the character in the CodeMap
pos: BytePos,
pub pos: BytePos,
/// The number of bytes, >=2
bytes: uint,
pub bytes: uint,
}
/// A single source in the CodeMap
@ -228,15 +228,15 @@ pub struct FileMap {
/// The name of the file that the source came from, source that doesn't
/// originate from files has names between angle brackets by convention,
/// e.g. `<anon>`
name: FileName,
pub name: FileName,
/// The complete source code
src: ~str,
pub src: ~str,
/// The start position of this source in the CodeMap
start_pos: BytePos,
pub start_pos: BytePos,
/// Locations of lines beginnings in the source code
lines: RefCell<Vec<BytePos> >,
pub lines: RefCell<Vec<BytePos> >,
/// Locations of multi-byte characters in the source code
multibyte_chars: RefCell<Vec<MultiByteChar> >,
pub multibyte_chars: RefCell<Vec<MultiByteChar> >,
}
impl FileMap {
@ -284,7 +284,7 @@ impl FileMap {
}
pub struct CodeMap {
files: RefCell<Vec<Rc<FileMap>>>
pub files: RefCell<Vec<Rc<FileMap>>>
}
impl CodeMap {

View File

@ -24,11 +24,11 @@ use std::from_str::FromStr;
pub struct CrateId {
/// A path which represents the codes origin. By convention this is the
/// URL, without `http://` or `https://` prefix, to the crate's repository
path: ~str,
pub path: ~str,
/// The name of the crate.
name: ~str,
pub name: ~str,
/// The version of the crate.
version: Option<~str>,
pub version: Option<~str>,
}
impl fmt::Show for CrateId {

View File

@ -40,8 +40,8 @@ pub struct ExplicitBug;
// accepts span information for source-location
// reporting.
pub struct SpanHandler {
handler: Handler,
cm: codemap::CodeMap,
pub handler: Handler,
pub cm: codemap::CodeMap,
}
impl SpanHandler {
@ -216,7 +216,7 @@ fn print_diagnostic(dst: &mut EmitterWriter,
}
pub struct EmitterWriter {
priv dst: Destination,
dst: Destination,
}
enum Destination {

View File

@ -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 {

View File

@ -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 {

View File

@ -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> {

View File

@ -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,

View File

@ -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

View File

@ -30,6 +30,8 @@ This API is completely unstable and subject to change.
quote)]
#![allow(deprecated)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
extern crate serialize;
extern crate term;
extern crate collections;

View File

@ -18,8 +18,8 @@ use serialize::{Encodable, Decodable, Encoder, Decoder};
#[unsafe_no_drop_flag] // data is set to null on destruction
pub struct OwnedSlice<T> {
/// null iff len == 0
priv data: *mut T,
priv len: uint,
data: *mut T,
len: uint,
}
#[unsafe_destructor]

View File

@ -31,9 +31,9 @@ pub enum CommentStyle {
#[deriving(Clone)]
pub struct Comment {
style: CommentStyle,
lines: Vec<~str> ,
pos: BytePos
pub style: CommentStyle,
pub lines: Vec<~str>,
pub pos: BytePos,
}
pub fn is_doc_comment(s: &str) -> bool {
@ -338,8 +338,8 @@ fn consume_comment(rdr: &mut StringReader,
#[deriving(Clone)]
pub struct Literal {
lit: ~str,
pos: BytePos
pub lit: ~str,
pub pos: BytePos,
}
// it appears this function is called only from pprust... that's

View File

@ -13,8 +13,8 @@ use parse::token;
// SeqSep : a sequence separator (token)
// and whether a trailing separator is allowed.
pub struct SeqSep {
sep: Option<token::Token>,
trailing_sep_allowed: bool
pub sep: Option<token::Token>,
pub trailing_sep_allowed: bool
}
pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {

View File

@ -34,24 +34,24 @@ pub trait Reader {
#[deriving(Clone, Eq, Show)]
pub struct TokenAndSpan {
tok: token::Token,
sp: Span,
pub tok: token::Token,
pub sp: Span,
}
pub struct StringReader<'a> {
span_diagnostic: &'a SpanHandler,
pub span_diagnostic: &'a SpanHandler,
// The absolute offset within the codemap of the next character to read
pos: BytePos,
pub pos: BytePos,
// The absolute offset within the codemap of the last character read(curr)
last_pos: BytePos,
pub last_pos: BytePos,
// The column of the next character to read
col: CharPos,
pub col: CharPos,
// The last character to be read
curr: Option<char>,
filemap: Rc<codemap::FileMap>,
pub curr: Option<char>,
pub filemap: Rc<codemap::FileMap>,
/* cached: */
peek_tok: token::Token,
peek_span: Span,
pub peek_tok: token::Token,
pub peek_span: Span,
}
impl<'a> StringReader<'a> {

View File

@ -39,7 +39,7 @@ pub mod obsolete;
// info about a parsing session.
pub struct ParseSess {
span_diagnostic: SpanHandler, // better be the same as the one in the reader!
pub span_diagnostic: SpanHandler, // better be the same as the one in the reader!
/// Used to determine and report recursive mod inclusions
included_mod_stack: RefCell<Vec<Path>>,
}

View File

@ -78,7 +78,6 @@ use parse::{new_sub_parser_from_file, ParseSess};
use owned_slice::OwnedSlice;
use collections::HashSet;
use std::kinds::marker;
use std::mem::replace;
use std::rc::Rc;
@ -113,8 +112,8 @@ pub enum PathParsingMode {
/// A path paired with optional type bounds.
pub struct PathAndBounds {
path: ast::Path,
bounds: Option<OwnedSlice<TyParamBound>>,
pub path: ast::Path,
pub bounds: Option<OwnedSlice<TyParamBound>>,
}
enum ItemOrViewItem {
@ -306,38 +305,35 @@ pub fn Parser<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, mut rdr: ~Reader:)
obsolete_set: HashSet::new(),
mod_path_stack: Vec::new(),
open_braces: Vec::new(),
nocopy: marker::NoCopy
}
}
pub struct Parser<'a> {
sess: &'a ParseSess,
cfg: CrateConfig,
pub sess: &'a ParseSess,
// the current token:
token: token::Token,
pub token: token::Token,
// the span of the current token:
span: Span,
pub span: Span,
// the span of the prior token:
last_span: Span,
pub last_span: Span,
pub cfg: CrateConfig,
// the previous token or None (only stashed sometimes).
last_token: Option<~token::Token>,
buffer: [TokenAndSpan, ..4],
buffer_start: int,
buffer_end: int,
tokens_consumed: uint,
restriction: restriction,
quote_depth: uint, // not (yet) related to the quasiquoter
reader: ~Reader:,
interner: Rc<token::IdentInterner>,
pub last_token: Option<~token::Token>,
pub buffer: [TokenAndSpan, ..4],
pub buffer_start: int,
pub buffer_end: int,
pub tokens_consumed: uint,
pub restriction: restriction,
pub quote_depth: uint, // not (yet) related to the quasiquoter
pub reader: ~Reader:,
pub interner: Rc<token::IdentInterner>,
/// The set of seen errors about obsolete syntax. Used to suppress
/// extra detail when the same error is seen twice
obsolete_set: HashSet<ObsoleteSyntax>,
pub obsolete_set: HashSet<ObsoleteSyntax>,
/// Used to determine the path to externally loaded source files
mod_path_stack: Vec<InternedString> ,
pub mod_path_stack: Vec<InternedString>,
/// Stack of spans of open delimiters. Used for error message.
open_braces: Vec<Span> ,
/* do not copy the parser; its state is tied to outside state */
priv nocopy: marker::NoCopy
pub open_braces: Vec<Span>,
}
fn is_plain_ident_or_underscore(t: &token::Token) -> bool {

View File

@ -556,7 +556,7 @@ pub fn get_ident_interner() -> Rc<IdentInterner> {
/// somehow.
#[deriving(Clone, Eq, Hash, Ord, TotalEq, TotalOrd)]
pub struct InternedString {
priv string: RcStr,
string: RcStr,
}
impl InternedString {

View File

@ -257,7 +257,7 @@ pub fn mk_printer(out: ~io::Writer, linewidth: uint) -> Printer {
* called 'print'.
*/
pub struct Printer {
out: ~io::Writer,
pub out: ~io::Writer,
buf_len: uint,
margin: int, // width of lines we're constrained to
space: int, // number of spaces left on line

View File

@ -54,7 +54,7 @@ pub struct CurrentCommentAndLiteral {
}
pub struct State<'a> {
s: pp::Printer,
pub s: pp::Printer,
cm: Option<&'a CodeMap>,
intr: Rc<token::IdentInterner>,
comments: Option<Vec<comments::Comment> >,

View File

@ -23,8 +23,8 @@ use std::hash::Hash;
use std::rc::Rc;
pub struct Interner<T> {
priv map: RefCell<HashMap<T, Name>>,
priv vect: RefCell<Vec<T> >,
map: RefCell<HashMap<T, Name>>,
vect: RefCell<Vec<T> >,
}
// when traits can extend traits, we should extend index<Name,T> to get []
@ -92,7 +92,7 @@ impl<T: TotalEq + Hash + Clone + 'static> Interner<T> {
#[deriving(Clone, Eq, Hash, Ord)]
pub struct RcStr {
priv string: Rc<~str>,
string: Rc<~str>,
}
impl TotalEq for RcStr {}
@ -134,8 +134,8 @@ impl RcStr {
// A StrInterner differs from Interner<String> in that it accepts
// &str rather than RcStr, resulting in less allocation.
pub struct StrInterner {
priv map: RefCell<HashMap<RcStr, Name>>,
priv vect: RefCell<Vec<RcStr> >,
map: RefCell<HashMap<RcStr, Name>>,
vect: RefCell<Vec<RcStr> >,
}
// when traits can extend traits, we should extend index<Name,T> to get []