syntax: Switch field privacy as necessary
This commit is contained in:
parent
c034d0c854
commit
3c76f4ac8d
24 changed files with 297 additions and 297 deletions
|
@ -67,7 +67,7 @@ pub enum AbiArchitecture {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct AbiSet {
|
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] = &[
|
static AbiDatas: &'static [AbiData] = &[
|
||||||
|
|
|
@ -40,8 +40,8 @@ pub fn P<T: 'static>(value: T) -> P<T> {
|
||||||
// That Work Together"
|
// That Work Together"
|
||||||
#[deriving(Clone, Hash, Ord, TotalEq, TotalOrd, Show)]
|
#[deriving(Clone, Hash, Ord, TotalEq, TotalOrd, Show)]
|
||||||
pub struct Ident {
|
pub struct Ident {
|
||||||
name: Name,
|
pub name: Name,
|
||||||
ctxt: SyntaxContext
|
pub ctxt: SyntaxContext
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ident {
|
impl Ident {
|
||||||
|
@ -115,9 +115,9 @@ pub type FnIdent = Option<Ident>;
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Lifetime {
|
pub struct Lifetime {
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
name: Name
|
pub name: Name
|
||||||
}
|
}
|
||||||
|
|
||||||
// a "Path" is essentially Rust's notion of a name;
|
// a "Path" is essentially Rust's notion of a name;
|
||||||
|
@ -126,12 +126,12 @@ pub struct Lifetime {
|
||||||
// of supporting information.
|
// of supporting information.
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Path {
|
pub struct Path {
|
||||||
span: Span,
|
pub span: Span,
|
||||||
/// A `::foo` path, is relative to the crate root rather than current
|
/// A `::foo` path, is relative to the crate root rather than current
|
||||||
/// module (like paths in an import).
|
/// module (like paths in an import).
|
||||||
global: bool,
|
pub global: bool,
|
||||||
/// The segments in the path: the things separated by `::`.
|
/// 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
|
/// 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)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct PathSegment {
|
pub struct PathSegment {
|
||||||
/// The identifier portion of this path segment.
|
/// The identifier portion of this path segment.
|
||||||
identifier: Ident,
|
pub identifier: Ident,
|
||||||
/// The lifetime parameters for this path segment.
|
/// The lifetime parameters for this path segment.
|
||||||
lifetimes: Vec<Lifetime>,
|
pub lifetimes: Vec<Lifetime>,
|
||||||
/// The type parameters for this path segment, if present.
|
/// The type parameters for this path segment, if present.
|
||||||
types: OwnedSlice<P<Ty>>,
|
pub types: OwnedSlice<P<Ty>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type CrateNum = u32;
|
pub type CrateNum = u32;
|
||||||
|
@ -152,8 +152,8 @@ pub type NodeId = u32;
|
||||||
|
|
||||||
#[deriving(Clone, TotalEq, TotalOrd, Ord, Eq, Encodable, Decodable, Hash, Show)]
|
#[deriving(Clone, TotalEq, TotalOrd, Ord, Eq, Encodable, Decodable, Hash, Show)]
|
||||||
pub struct DefId {
|
pub struct DefId {
|
||||||
krate: CrateNum,
|
pub krate: CrateNum,
|
||||||
node: NodeId,
|
pub node: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Item definitions in the currently-compiled crate would have the CrateNum
|
/// 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)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct TyParam {
|
pub struct TyParam {
|
||||||
ident: Ident,
|
pub ident: Ident,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
bounds: OwnedSlice<TyParamBound>,
|
pub bounds: OwnedSlice<TyParamBound>,
|
||||||
default: Option<P<Ty>>
|
pub default: Option<P<Ty>>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Generics {
|
pub struct Generics {
|
||||||
lifetimes: Vec<Lifetime>,
|
pub lifetimes: Vec<Lifetime>,
|
||||||
ty_params: OwnedSlice<TyParam>,
|
pub ty_params: OwnedSlice<TyParam>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Generics {
|
impl Generics {
|
||||||
|
@ -259,10 +259,10 @@ pub type CrateConfig = Vec<@MetaItem> ;
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Crate {
|
pub struct Crate {
|
||||||
module: Mod,
|
pub module: Mod,
|
||||||
attrs: Vec<Attribute> ,
|
pub attrs: Vec<Attribute>,
|
||||||
config: CrateConfig,
|
pub config: CrateConfig,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type MetaItem = Spanned<MetaItem_>;
|
pub type MetaItem = Spanned<MetaItem_>;
|
||||||
|
@ -301,25 +301,25 @@ impl Eq for MetaItem_ {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
view_items: Vec<ViewItem> ,
|
pub view_items: Vec<ViewItem>,
|
||||||
stmts: Vec<@Stmt> ,
|
pub stmts: Vec<@Stmt>,
|
||||||
expr: Option<@Expr>,
|
pub expr: Option<@Expr>,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
rules: BlockCheckMode,
|
pub rules: BlockCheckMode,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Pat {
|
pub struct Pat {
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
node: Pat_,
|
pub node: Pat_,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct FieldPat {
|
pub struct FieldPat {
|
||||||
ident: Ident,
|
pub ident: Ident,
|
||||||
pat: @Pat,
|
pub pat: @Pat,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[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>;`
|
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
|
||||||
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Local {
|
pub struct Local {
|
||||||
ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
pat: @Pat,
|
pub pat: @Pat,
|
||||||
init: Option<@Expr>,
|
pub init: Option<@Expr>,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Decl = Spanned<Decl_>;
|
pub type Decl = Spanned<Decl_>;
|
||||||
|
@ -455,16 +455,16 @@ pub enum Decl_ {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Arm {
|
pub struct Arm {
|
||||||
pats: Vec<@Pat> ,
|
pub pats: Vec<@Pat>,
|
||||||
guard: Option<@Expr>,
|
pub guard: Option<@Expr>,
|
||||||
body: @Expr,
|
pub body: @Expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Field {
|
pub struct Field {
|
||||||
ident: SpannedIdent,
|
pub ident: SpannedIdent,
|
||||||
expr: @Expr,
|
pub expr: @Expr,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type SpannedIdent = Spanned<Ident>;
|
pub type SpannedIdent = Spanned<Ident>;
|
||||||
|
@ -483,9 +483,9 @@ pub enum UnsafeSource {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Expr {
|
pub struct Expr {
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
node: Expr_,
|
pub node: Expr_,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
|
@ -681,27 +681,27 @@ pub enum Lit_ {
|
||||||
// type structure in middle/ty.rs as well.
|
// type structure in middle/ty.rs as well.
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct MutTy {
|
pub struct MutTy {
|
||||||
ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
mutbl: Mutability,
|
pub mutbl: Mutability,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct TypeField {
|
pub struct TypeField {
|
||||||
ident: Ident,
|
pub ident: Ident,
|
||||||
mt: MutTy,
|
pub mt: MutTy,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct TypeMethod {
|
pub struct TypeMethod {
|
||||||
ident: Ident,
|
pub ident: Ident,
|
||||||
attrs: Vec<Attribute> ,
|
pub attrs: Vec<Attribute>,
|
||||||
purity: Purity,
|
pub purity: Purity,
|
||||||
decl: P<FnDecl>,
|
pub decl: P<FnDecl>,
|
||||||
generics: Generics,
|
pub generics: Generics,
|
||||||
explicit_self: ExplicitSelf,
|
pub explicit_self: ExplicitSelf,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
// A trait method is either required (meaning it doesn't have an
|
// 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.
|
// NB Eq method appears below.
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Ty {
|
pub struct Ty {
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
node: Ty_,
|
pub node: Ty_,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not represented directly in the AST, referred to by name through a ty_path.
|
// 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)]
|
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct ClosureTy {
|
pub struct ClosureTy {
|
||||||
sigil: Sigil,
|
pub sigil: Sigil,
|
||||||
region: Option<Lifetime>,
|
pub region: Option<Lifetime>,
|
||||||
lifetimes: Vec<Lifetime>,
|
pub lifetimes: Vec<Lifetime>,
|
||||||
purity: Purity,
|
pub purity: Purity,
|
||||||
onceness: Onceness,
|
pub onceness: Onceness,
|
||||||
decl: P<FnDecl>,
|
pub decl: P<FnDecl>,
|
||||||
// Optional optvec distinguishes between "fn()" and "fn:()" so we can
|
// Optional optvec distinguishes between "fn()" and "fn:()" so we can
|
||||||
// implement issue #7264. None means "fn()", which means infer a default
|
// implement issue #7264. None means "fn()", which means infer a default
|
||||||
// bound based on pointer sigil during typeck. Some(Empty) means "fn:()",
|
// bound based on pointer sigil during typeck. Some(Empty) means "fn:()",
|
||||||
// which means use no bounds (e.g., not even Owned on a ~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)]
|
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct BareFnTy {
|
pub struct BareFnTy {
|
||||||
purity: Purity,
|
pub purity: Purity,
|
||||||
abis: AbiSet,
|
pub abis: AbiSet,
|
||||||
lifetimes: Vec<Lifetime>,
|
pub lifetimes: Vec<Lifetime>,
|
||||||
decl: P<FnDecl>
|
pub decl: P<FnDecl>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
|
@ -840,21 +840,21 @@ pub enum AsmDialect {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct InlineAsm {
|
pub struct InlineAsm {
|
||||||
asm: InternedString,
|
pub asm: InternedString,
|
||||||
asm_str_style: StrStyle,
|
pub asm_str_style: StrStyle,
|
||||||
clobbers: InternedString,
|
pub clobbers: InternedString,
|
||||||
inputs: Vec<(InternedString, @Expr)> ,
|
pub inputs: Vec<(InternedString, @Expr)>,
|
||||||
outputs: Vec<(InternedString, @Expr)> ,
|
pub outputs: Vec<(InternedString, @Expr)>,
|
||||||
volatile: bool,
|
pub volatile: bool,
|
||||||
alignstack: bool,
|
pub alignstack: bool,
|
||||||
dialect: AsmDialect
|
pub dialect: AsmDialect
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Arg {
|
pub struct Arg {
|
||||||
ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
pat: @Pat,
|
pub pat: @Pat,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Arg {
|
impl Arg {
|
||||||
|
@ -879,10 +879,10 @@ impl Arg {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct FnDecl {
|
pub struct FnDecl {
|
||||||
inputs: Vec<Arg> ,
|
pub inputs: Vec<Arg>,
|
||||||
output: P<Ty>,
|
pub output: P<Ty>,
|
||||||
cf: RetStyle,
|
pub cf: RetStyle,
|
||||||
variadic: bool
|
pub variadic: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
|
@ -921,35 +921,35 @@ pub type ExplicitSelf = Spanned<ExplicitSelf_>;
|
||||||
|
|
||||||
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Method {
|
pub struct Method {
|
||||||
ident: Ident,
|
pub ident: Ident,
|
||||||
attrs: Vec<Attribute> ,
|
pub attrs: Vec<Attribute>,
|
||||||
generics: Generics,
|
pub generics: Generics,
|
||||||
explicit_self: ExplicitSelf,
|
pub explicit_self: ExplicitSelf,
|
||||||
purity: Purity,
|
pub purity: Purity,
|
||||||
decl: P<FnDecl>,
|
pub decl: P<FnDecl>,
|
||||||
body: P<Block>,
|
pub body: P<Block>,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
vis: Visibility,
|
pub vis: Visibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Mod {
|
pub struct Mod {
|
||||||
view_items: Vec<ViewItem> ,
|
pub view_items: Vec<ViewItem> ,
|
||||||
items: Vec<@Item> ,
|
pub items: Vec<@Item> ,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct ForeignMod {
|
pub struct ForeignMod {
|
||||||
abis: AbiSet,
|
pub abis: AbiSet,
|
||||||
view_items: Vec<ViewItem> ,
|
pub view_items: Vec<ViewItem>,
|
||||||
items: Vec<@ForeignItem> ,
|
pub items: Vec<@ForeignItem>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct VariantArg {
|
pub struct VariantArg {
|
||||||
ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
|
@ -960,25 +960,25 @@ pub enum VariantKind {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct EnumDef {
|
pub struct EnumDef {
|
||||||
variants: Vec<P<Variant>> ,
|
pub variants: Vec<P<Variant>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Variant_ {
|
pub struct Variant_ {
|
||||||
name: Ident,
|
pub name: Ident,
|
||||||
attrs: Vec<Attribute> ,
|
pub attrs: Vec<Attribute>,
|
||||||
kind: VariantKind,
|
pub kind: VariantKind,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
disr_expr: Option<@Expr>,
|
pub disr_expr: Option<@Expr>,
|
||||||
vis: Visibility,
|
pub vis: Visibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Variant = Spanned<Variant_>;
|
pub type Variant = Spanned<Variant_>;
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct PathListIdent_ {
|
pub struct PathListIdent_ {
|
||||||
name: Ident,
|
pub name: Ident,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PathListIdent = Spanned<PathListIdent_>;
|
pub type PathListIdent = Spanned<PathListIdent_>;
|
||||||
|
@ -1004,10 +1004,10 @@ pub enum ViewPath_ {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct ViewItem {
|
pub struct ViewItem {
|
||||||
node: ViewItem_,
|
pub node: ViewItem_,
|
||||||
attrs: Vec<Attribute> ,
|
pub attrs: Vec<Attribute>,
|
||||||
vis: Visibility,
|
pub vis: Visibility,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[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
|
// doc-comments are promoted to attributes that have is_sugared_doc = true
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Attribute_ {
|
pub struct Attribute_ {
|
||||||
style: AttrStyle,
|
pub style: AttrStyle,
|
||||||
value: @MetaItem,
|
pub value: @MetaItem,
|
||||||
is_sugared_doc: bool,
|
pub is_sugared_doc: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1049,8 +1049,8 @@ pub struct Attribute_ {
|
||||||
*/
|
*/
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct TraitRef {
|
pub struct TraitRef {
|
||||||
path: Path,
|
pub path: Path,
|
||||||
ref_id: NodeId,
|
pub ref_id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
|
@ -1071,10 +1071,10 @@ impl Visibility {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct StructField_ {
|
pub struct StructField_ {
|
||||||
kind: StructFieldKind,
|
pub kind: StructFieldKind,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
attrs: Vec<Attribute> ,
|
pub attrs: Vec<Attribute>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type StructField = Spanned<StructField_>;
|
pub type StructField = Spanned<StructField_>;
|
||||||
|
@ -1096,10 +1096,10 @@ impl StructFieldKind {
|
||||||
|
|
||||||
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct StructDef {
|
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
|
/* ID of the constructor. This is only used for tuple- or enum-like
|
||||||
* structs. */
|
* structs. */
|
||||||
ctor_id: Option<NodeId>
|
pub ctor_id: Option<NodeId>
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1108,12 +1108,12 @@ pub struct StructDef {
|
||||||
*/
|
*/
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Item {
|
pub struct Item {
|
||||||
ident: Ident,
|
pub ident: Ident,
|
||||||
attrs: Vec<Attribute> ,
|
pub attrs: Vec<Attribute>,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
node: Item_,
|
pub node: Item_,
|
||||||
vis: Visibility,
|
pub vis: Visibility,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
|
@ -1136,12 +1136,12 @@ pub enum Item_ {
|
||||||
|
|
||||||
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct ForeignItem {
|
pub struct ForeignItem {
|
||||||
ident: Ident,
|
pub ident: Ident,
|
||||||
attrs: Vec<Attribute> ,
|
pub attrs: Vec<Attribute>,
|
||||||
node: ForeignItem_,
|
pub node: ForeignItem_,
|
||||||
id: NodeId,
|
pub id: NodeId,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
vis: Visibility,
|
pub vis: Visibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
|
|
|
@ -184,7 +184,7 @@ pub struct Map {
|
||||||
///
|
///
|
||||||
/// Also, indexing is pretty quick when you've got a vector and
|
/// Also, indexing is pretty quick when you've got a vector and
|
||||||
/// plain old integers.
|
/// plain old integers.
|
||||||
priv map: RefCell<Vec<MapEntry> >
|
map: RefCell<Vec<MapEntry> >
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Map {
|
impl Map {
|
||||||
|
|
|
@ -325,8 +325,8 @@ pub fn empty_generics() -> Generics {
|
||||||
|
|
||||||
#[deriving(Encodable, Decodable)]
|
#[deriving(Encodable, Decodable)]
|
||||||
pub struct IdRange {
|
pub struct IdRange {
|
||||||
min: NodeId,
|
pub min: NodeId,
|
||||||
max: NodeId,
|
pub max: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IdRange {
|
impl IdRange {
|
||||||
|
@ -352,9 +352,9 @@ pub trait IdVisitingOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct IdVisitor<'a, O> {
|
pub struct IdVisitor<'a, O> {
|
||||||
operation: &'a O,
|
pub operation: &'a O,
|
||||||
pass_through_items: bool,
|
pub pass_through_items: bool,
|
||||||
visited_outermost: bool,
|
pub visited_outermost: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> {
|
impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> {
|
||||||
|
|
|
@ -337,8 +337,8 @@ pub fn test_cfg<AM: AttrMetaMethods, It: Iterator<AM>>
|
||||||
|
|
||||||
/// Represents the #[deprecated="foo"] (etc) attributes.
|
/// Represents the #[deprecated="foo"] (etc) attributes.
|
||||||
pub struct Stability {
|
pub struct Stability {
|
||||||
level: StabilityLevel,
|
pub level: StabilityLevel,
|
||||||
text: Option<InternedString>
|
pub text: Option<InternedString>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The available stability levels.
|
/// The available stability levels.
|
||||||
|
|
|
@ -86,19 +86,19 @@ to the original source.
|
||||||
*/
|
*/
|
||||||
#[deriving(Clone, Show, Hash)]
|
#[deriving(Clone, Show, Hash)]
|
||||||
pub struct Span {
|
pub struct Span {
|
||||||
lo: BytePos,
|
pub lo: BytePos,
|
||||||
hi: BytePos,
|
pub hi: BytePos,
|
||||||
/// Information about where the macro came from, if this piece of
|
/// Information about where the macro came from, if this piece of
|
||||||
/// code was created by a macro expansion.
|
/// 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 };
|
pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None };
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||||
pub struct Spanned<T> {
|
pub struct Spanned<T> {
|
||||||
node: T,
|
pub node: T,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for 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
|
/// A source code location used for error reporting
|
||||||
pub struct Loc {
|
pub struct Loc {
|
||||||
/// Information about the original source
|
/// Information about the original source
|
||||||
file: Rc<FileMap>,
|
pub file: Rc<FileMap>,
|
||||||
/// The (1-based) line number
|
/// The (1-based) line number
|
||||||
line: uint,
|
pub line: uint,
|
||||||
/// The (0-based) column offset
|
/// The (0-based) column offset
|
||||||
col: CharPos
|
pub col: CharPos
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A source code location used as the result of lookup_char_pos_adj
|
/// A source code location used as the result of lookup_char_pos_adj
|
||||||
// Actually, *none* of the clients use the filename *or* file field;
|
// Actually, *none* of the clients use the filename *or* file field;
|
||||||
// perhaps they should just be removed.
|
// perhaps they should just be removed.
|
||||||
pub struct LocWithOpt {
|
pub struct LocWithOpt {
|
||||||
filename: FileName,
|
pub filename: FileName,
|
||||||
line: uint,
|
pub line: uint,
|
||||||
col: CharPos,
|
pub col: CharPos,
|
||||||
file: Option<Rc<FileMap>>,
|
pub file: Option<Rc<FileMap>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to be structural records. Better names, anyone?
|
// used to be structural records. Better names, anyone?
|
||||||
pub struct FileMapAndLine {fm: Rc<FileMap>, line: uint}
|
pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: uint }
|
||||||
pub struct FileMapAndBytePos {fm: Rc<FileMap>, pos: BytePos}
|
pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
|
||||||
|
|
||||||
/// The syntax with which a macro was invoked.
|
/// The syntax with which a macro was invoked.
|
||||||
#[deriving(Clone, Hash, Show)]
|
#[deriving(Clone, Hash, Show)]
|
||||||
|
@ -177,13 +177,13 @@ pub enum MacroFormat {
|
||||||
pub struct NameAndSpan {
|
pub struct NameAndSpan {
|
||||||
/// The name of the macro that was invoked to create the thing
|
/// The name of the macro that was invoked to create the thing
|
||||||
/// with this Span.
|
/// with this Span.
|
||||||
name: ~str,
|
pub name: ~str,
|
||||||
/// The format with which the macro was invoked.
|
/// The format with which the macro was invoked.
|
||||||
format: MacroFormat,
|
pub format: MacroFormat,
|
||||||
/// The span of the macro definition itself. The macro may not
|
/// The span of the macro definition itself. The macro may not
|
||||||
/// have a sensible definition span (e.g. something defined
|
/// have a sensible definition span (e.g. something defined
|
||||||
/// completely inside libsyntax) in which case this is None.
|
/// completely inside libsyntax) in which case this is None.
|
||||||
span: Option<Span>
|
pub span: Option<Span>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extra information for tracking macro expansion of spans
|
/// Extra information for tracking macro expansion of spans
|
||||||
|
@ -198,29 +198,29 @@ pub struct ExpnInfo {
|
||||||
/// the expansion would point to the `bar!` invocation; that
|
/// the expansion would point to the `bar!` invocation; that
|
||||||
/// call_site span would have its own ExpnInfo, with the call_site
|
/// call_site span would have its own ExpnInfo, with the call_site
|
||||||
/// pointing to the `foo!` invocation.
|
/// pointing to the `foo!` invocation.
|
||||||
call_site: Span,
|
pub call_site: Span,
|
||||||
/// Information about the macro and its definition.
|
/// Information about the macro and its definition.
|
||||||
///
|
///
|
||||||
/// The `callee` of the inner expression in the `call_site`
|
/// The `callee` of the inner expression in the `call_site`
|
||||||
/// example would point to the `macro_rules! bar { ... }` and that
|
/// example would point to the `macro_rules! bar { ... }` and that
|
||||||
/// of the `bar!()` invocation would point to the `macro_rules!
|
/// of the `bar!()` invocation would point to the `macro_rules!
|
||||||
/// foo { ... }`.
|
/// foo { ... }`.
|
||||||
callee: NameAndSpan
|
pub callee: NameAndSpan
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type FileName = ~str;
|
pub type FileName = ~str;
|
||||||
|
|
||||||
pub struct FileLines {
|
pub struct FileLines {
|
||||||
file: Rc<FileMap>,
|
pub file: Rc<FileMap>,
|
||||||
lines: Vec<uint>
|
pub lines: Vec<uint>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Identifies an offset of a multi-byte character in a FileMap
|
/// Identifies an offset of a multi-byte character in a FileMap
|
||||||
pub struct MultiByteChar {
|
pub struct MultiByteChar {
|
||||||
/// The absolute offset of the character in the CodeMap
|
/// The absolute offset of the character in the CodeMap
|
||||||
pos: BytePos,
|
pub pos: BytePos,
|
||||||
/// The number of bytes, >=2
|
/// The number of bytes, >=2
|
||||||
bytes: uint,
|
pub bytes: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single source in the CodeMap
|
/// 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
|
/// The name of the file that the source came from, source that doesn't
|
||||||
/// originate from files has names between angle brackets by convention,
|
/// originate from files has names between angle brackets by convention,
|
||||||
/// e.g. `<anon>`
|
/// e.g. `<anon>`
|
||||||
name: FileName,
|
pub name: FileName,
|
||||||
/// The complete source code
|
/// The complete source code
|
||||||
src: ~str,
|
pub src: ~str,
|
||||||
/// The start position of this source in the CodeMap
|
/// The start position of this source in the CodeMap
|
||||||
start_pos: BytePos,
|
pub start_pos: BytePos,
|
||||||
/// Locations of lines beginnings in the source code
|
/// 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
|
/// Locations of multi-byte characters in the source code
|
||||||
multibyte_chars: RefCell<Vec<MultiByteChar> >,
|
pub multibyte_chars: RefCell<Vec<MultiByteChar> >,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FileMap {
|
impl FileMap {
|
||||||
|
@ -284,7 +284,7 @@ impl FileMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CodeMap {
|
pub struct CodeMap {
|
||||||
files: RefCell<Vec<Rc<FileMap>>>
|
pub files: RefCell<Vec<Rc<FileMap>>>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CodeMap {
|
impl CodeMap {
|
||||||
|
|
|
@ -24,11 +24,11 @@ use std::from_str::FromStr;
|
||||||
pub struct CrateId {
|
pub struct CrateId {
|
||||||
/// A path which represents the codes origin. By convention this is the
|
/// A path which represents the codes origin. By convention this is the
|
||||||
/// URL, without `http://` or `https://` prefix, to the crate's repository
|
/// URL, without `http://` or `https://` prefix, to the crate's repository
|
||||||
path: ~str,
|
pub path: ~str,
|
||||||
/// The name of the crate.
|
/// The name of the crate.
|
||||||
name: ~str,
|
pub name: ~str,
|
||||||
/// The version of the crate.
|
/// The version of the crate.
|
||||||
version: Option<~str>,
|
pub version: Option<~str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for CrateId {
|
impl fmt::Show for CrateId {
|
||||||
|
|
|
@ -40,8 +40,8 @@ pub struct ExplicitBug;
|
||||||
// accepts span information for source-location
|
// accepts span information for source-location
|
||||||
// reporting.
|
// reporting.
|
||||||
pub struct SpanHandler {
|
pub struct SpanHandler {
|
||||||
handler: Handler,
|
pub handler: Handler,
|
||||||
cm: codemap::CodeMap,
|
pub cm: codemap::CodeMap,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SpanHandler {
|
impl SpanHandler {
|
||||||
|
@ -216,7 +216,7 @@ fn print_diagnostic(dst: &mut EmitterWriter,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct EmitterWriter {
|
pub struct EmitterWriter {
|
||||||
priv dst: Destination,
|
dst: Destination,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Destination {
|
enum Destination {
|
||||||
|
|
|
@ -30,8 +30,8 @@ use collections::HashMap;
|
||||||
// ast::MacInvocTT.
|
// ast::MacInvocTT.
|
||||||
|
|
||||||
pub struct MacroDef {
|
pub struct MacroDef {
|
||||||
name: ~str,
|
pub name: ~str,
|
||||||
ext: SyntaxExtension
|
pub ext: SyntaxExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type ItemDecorator =
|
pub type ItemDecorator =
|
||||||
|
@ -41,8 +41,8 @@ pub type ItemModifier =
|
||||||
fn(&mut ExtCtxt, Span, @ast::MetaItem, @ast::Item) -> @ast::Item;
|
fn(&mut ExtCtxt, Span, @ast::MetaItem, @ast::Item) -> @ast::Item;
|
||||||
|
|
||||||
pub struct BasicMacroExpander {
|
pub struct BasicMacroExpander {
|
||||||
expander: MacroExpanderFn,
|
pub expander: MacroExpanderFn,
|
||||||
span: Option<Span>
|
pub span: Option<Span>
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait MacroExpander {
|
pub trait MacroExpander {
|
||||||
|
@ -68,8 +68,8 @@ impl MacroExpander for BasicMacroExpander {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BasicIdentMacroExpander {
|
pub struct BasicIdentMacroExpander {
|
||||||
expander: IdentMacroExpanderFn,
|
pub expander: IdentMacroExpanderFn,
|
||||||
span: Option<Span>
|
pub span: Option<Span>
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait IdentMacroExpander {
|
pub trait IdentMacroExpander {
|
||||||
|
@ -172,9 +172,9 @@ pub enum SyntaxExtension {
|
||||||
|
|
||||||
pub struct BlockInfo {
|
pub struct BlockInfo {
|
||||||
// should macros escape from this scope?
|
// should macros escape from this scope?
|
||||||
macros_escape: bool,
|
pub macros_escape: bool,
|
||||||
// what are the pending renames?
|
// what are the pending renames?
|
||||||
pending_renames: RenameList,
|
pub pending_renames: RenameList,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockInfo {
|
impl BlockInfo {
|
||||||
|
@ -292,8 +292,8 @@ pub fn syntax_expander_table() -> SyntaxEnv {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MacroCrate {
|
pub struct MacroCrate {
|
||||||
lib: Option<Path>,
|
pub lib: Option<Path>,
|
||||||
cnum: ast::CrateNum,
|
pub cnum: ast::CrateNum,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait CrateLoader {
|
pub trait CrateLoader {
|
||||||
|
@ -306,13 +306,13 @@ pub trait CrateLoader {
|
||||||
// when a macro expansion occurs, the resulting nodes have the backtrace()
|
// when a macro expansion occurs, the resulting nodes have the backtrace()
|
||||||
// -> expn_info of their expansion context stored into their span.
|
// -> expn_info of their expansion context stored into their span.
|
||||||
pub struct ExtCtxt<'a> {
|
pub struct ExtCtxt<'a> {
|
||||||
parse_sess: &'a parse::ParseSess,
|
pub parse_sess: &'a parse::ParseSess,
|
||||||
cfg: ast::CrateConfig,
|
pub cfg: ast::CrateConfig,
|
||||||
backtrace: Option<@ExpnInfo>,
|
pub backtrace: Option<@ExpnInfo>,
|
||||||
ecfg: expand::ExpansionConfig<'a>,
|
pub ecfg: expand::ExpansionConfig<'a>,
|
||||||
|
|
||||||
mod_path: Vec<ast::Ident> ,
|
pub mod_path: Vec<ast::Ident> ,
|
||||||
trace_mac: bool
|
pub trace_mac: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ExtCtxt<'a> {
|
impl<'a> ExtCtxt<'a> {
|
||||||
|
@ -532,7 +532,7 @@ struct MapChainFrame {
|
||||||
|
|
||||||
// Only generic to make it easy to test
|
// Only generic to make it easy to test
|
||||||
pub struct SyntaxEnv {
|
pub struct SyntaxEnv {
|
||||||
priv chain: Vec<MapChainFrame> ,
|
chain: Vec<MapChainFrame> ,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SyntaxEnv {
|
impl SyntaxEnv {
|
||||||
|
|
|
@ -192,75 +192,77 @@ mod ty;
|
||||||
|
|
||||||
pub struct TraitDef<'a> {
|
pub struct TraitDef<'a> {
|
||||||
/// The span for the current #[deriving(Foo)] header.
|
/// 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 of the trait, including any type parameters
|
||||||
path: Path<'a>,
|
pub path: Path<'a>,
|
||||||
|
|
||||||
/// Additional bounds required of any type parameters of the type,
|
/// Additional bounds required of any type parameters of the type,
|
||||||
/// other than the current trait
|
/// 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`
|
/// 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> {
|
pub struct MethodDef<'a> {
|
||||||
/// name of the method
|
/// name of the method
|
||||||
name: &'a str,
|
pub name: &'a str,
|
||||||
/// List of generics, e.g. `R: rand::Rng`
|
/// 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
|
/// Whether there is a self argument (outer Option) i.e. whether
|
||||||
/// this is a static function, and whether it is a pointer (inner
|
/// this is a static function, and whether it is a pointer (inner
|
||||||
/// Option)
|
/// Option)
|
||||||
explicit_self: Option<Option<PtrTy<'a>>>,
|
pub explicit_self: Option<Option<PtrTy<'a>>>,
|
||||||
|
|
||||||
/// Arguments other than the self argument
|
/// Arguments other than the self argument
|
||||||
args: Vec<Ty<'a>> ,
|
pub args: Vec<Ty<'a>>,
|
||||||
|
|
||||||
/// Return type
|
/// Return type
|
||||||
ret_ty: Ty<'a>,
|
pub ret_ty: Ty<'a>,
|
||||||
|
|
||||||
/// Whether to mark this as #[inline]
|
/// Whether to mark this as #[inline]
|
||||||
inline: bool,
|
pub inline: bool,
|
||||||
|
|
||||||
/// if the value of the nonmatching enums is independent of the
|
/// if the value of the nonmatching enums is independent of the
|
||||||
/// actual enum variants, i.e. can use _ => .. match.
|
/// 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.
|
/// All the data about the data structure/method being derived upon.
|
||||||
pub struct Substructure<'a> {
|
pub struct Substructure<'a> {
|
||||||
/// ident of self
|
/// ident of self
|
||||||
type_ident: Ident,
|
pub type_ident: Ident,
|
||||||
/// ident of the method
|
/// ident of the method
|
||||||
method_ident: Ident,
|
pub method_ident: Ident,
|
||||||
/// dereferenced access to any Self or Ptr(Self, _) arguments
|
/// dereferenced access to any Self or Ptr(Self, _) arguments
|
||||||
self_args: &'a [@Expr],
|
pub self_args: &'a [@Expr],
|
||||||
/// verbatim access to any other arguments
|
/// verbatim access to any other arguments
|
||||||
nonself_args: &'a [@Expr],
|
pub nonself_args: &'a [@Expr],
|
||||||
fields: &'a SubstructureFields<'a>
|
pub fields: &'a SubstructureFields<'a>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Summary of the relevant parts of a struct/enum field.
|
/// Summary of the relevant parts of a struct/enum field.
|
||||||
pub struct FieldInfo {
|
pub struct FieldInfo {
|
||||||
span: Span,
|
pub span: Span,
|
||||||
/// None for tuple structs/normal enum variants, Some for normal
|
/// None for tuple structs/normal enum variants, Some for normal
|
||||||
/// structs/struct enum variants.
|
/// structs/struct enum variants.
|
||||||
name: Option<Ident>,
|
pub name: Option<Ident>,
|
||||||
/// The expression corresponding to this field of `self`
|
/// The expression corresponding to this field of `self`
|
||||||
/// (specifically, a reference to it).
|
/// (specifically, a reference to it).
|
||||||
self_: @Expr,
|
pub self_: @Expr,
|
||||||
/// The expressions corresponding to references to this field in
|
/// The expressions corresponding to references to this field in
|
||||||
/// the other Self arguments.
|
/// the other Self arguments.
|
||||||
other: Vec<@Expr> }
|
pub other: Vec<@Expr>,
|
||||||
|
}
|
||||||
|
|
||||||
/// Fields for a static method
|
/// Fields for a static method
|
||||||
pub enum StaticFields {
|
pub enum StaticFields {
|
||||||
|
|
|
@ -29,10 +29,10 @@ pub enum PtrTy<'a> {
|
||||||
/// A path, e.g. `::std::option::Option::<int>` (global). Has support
|
/// A path, e.g. `::std::option::Option::<int>` (global). Has support
|
||||||
/// for type parameters and a lifetime.
|
/// for type parameters and a lifetime.
|
||||||
pub struct Path<'a> {
|
pub struct Path<'a> {
|
||||||
path: Vec<&'a str> ,
|
pub path: Vec<&'a str> ,
|
||||||
lifetime: Option<&'a str>,
|
pub lifetime: Option<&'a str>,
|
||||||
params: Vec<~Ty<'a>> ,
|
pub params: Vec<~Ty<'a>> ,
|
||||||
global: bool
|
pub global: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Path<'a> {
|
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
|
/// Lifetimes and bounds on type parameters
|
||||||
pub struct LifetimeBounds<'a> {
|
pub struct LifetimeBounds<'a> {
|
||||||
lifetimes: Vec<&'a str>,
|
pub lifetimes: Vec<&'a str>,
|
||||||
bounds: Vec<(&'a str, Vec<Path<'a>>)>,
|
pub bounds: Vec<(&'a str, Vec<Path<'a>>)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> LifetimeBounds<'a> {
|
impl<'a> LifetimeBounds<'a> {
|
||||||
|
|
|
@ -838,8 +838,8 @@ pub fn new_span(cx: &ExtCtxt, sp: Span) -> Span {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MacroExpander<'a, 'b> {
|
pub struct MacroExpander<'a, 'b> {
|
||||||
extsbox: SyntaxEnv,
|
pub extsbox: SyntaxEnv,
|
||||||
cx: &'a mut ExtCtxt<'b>,
|
pub cx: &'a mut ExtCtxt<'b>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Folder for MacroExpander<'a, '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> {
|
pub struct ExpansionConfig<'a> {
|
||||||
loader: &'a mut CrateLoader,
|
pub loader: &'a mut CrateLoader,
|
||||||
deriving_hash_type_parameter: bool,
|
pub deriving_hash_type_parameter: bool,
|
||||||
crate_id: CrateId,
|
pub crate_id: CrateId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expand_crate(parse_sess: &parse::ParseSess,
|
pub fn expand_crate(parse_sess: &parse::ParseSess,
|
||||||
|
|
|
@ -31,16 +31,16 @@ struct TtFrame {
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct TtReader<'a> {
|
pub struct TtReader<'a> {
|
||||||
sp_diag: &'a SpanHandler,
|
pub sp_diag: &'a SpanHandler,
|
||||||
// the unzipped tree:
|
// the unzipped tree:
|
||||||
priv stack: Vec<TtFrame>,
|
stack: Vec<TtFrame>,
|
||||||
/* for MBE-style macro transcription */
|
/* for MBE-style macro transcription */
|
||||||
priv interpolations: HashMap<Ident, Rc<NamedMatch>>,
|
interpolations: HashMap<Ident, Rc<NamedMatch>>,
|
||||||
priv repeat_idx: Vec<uint>,
|
repeat_idx: Vec<uint>,
|
||||||
priv repeat_len: Vec<uint>,
|
repeat_len: Vec<uint>,
|
||||||
/* cached: */
|
/* cached: */
|
||||||
cur_tok: Token,
|
pub cur_tok: Token,
|
||||||
cur_span: Span,
|
pub cur_span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This can do Macro-By-Example transcription. On the other hand, if
|
/** This can do Macro-By-Example transcription. On the other hand, if
|
||||||
|
|
|
@ -30,6 +30,8 @@ This API is completely unstable and subject to change.
|
||||||
quote)]
|
quote)]
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
|
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
|
||||||
|
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate term;
|
extern crate term;
|
||||||
extern crate collections;
|
extern crate collections;
|
||||||
|
|
|
@ -18,8 +18,8 @@ use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||||
#[unsafe_no_drop_flag] // data is set to null on destruction
|
#[unsafe_no_drop_flag] // data is set to null on destruction
|
||||||
pub struct OwnedSlice<T> {
|
pub struct OwnedSlice<T> {
|
||||||
/// null iff len == 0
|
/// null iff len == 0
|
||||||
priv data: *mut T,
|
data: *mut T,
|
||||||
priv len: uint,
|
len: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
|
|
@ -31,9 +31,9 @@ pub enum CommentStyle {
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Comment {
|
pub struct Comment {
|
||||||
style: CommentStyle,
|
pub style: CommentStyle,
|
||||||
lines: Vec<~str> ,
|
pub lines: Vec<~str>,
|
||||||
pos: BytePos
|
pub pos: BytePos,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_doc_comment(s: &str) -> bool {
|
pub fn is_doc_comment(s: &str) -> bool {
|
||||||
|
@ -338,8 +338,8 @@ fn consume_comment(rdr: &mut StringReader,
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Literal {
|
pub struct Literal {
|
||||||
lit: ~str,
|
pub lit: ~str,
|
||||||
pos: BytePos
|
pub pos: BytePos,
|
||||||
}
|
}
|
||||||
|
|
||||||
// it appears this function is called only from pprust... that's
|
// it appears this function is called only from pprust... that's
|
||||||
|
|
|
@ -13,8 +13,8 @@ use parse::token;
|
||||||
// SeqSep : a sequence separator (token)
|
// SeqSep : a sequence separator (token)
|
||||||
// and whether a trailing separator is allowed.
|
// and whether a trailing separator is allowed.
|
||||||
pub struct SeqSep {
|
pub struct SeqSep {
|
||||||
sep: Option<token::Token>,
|
pub sep: Option<token::Token>,
|
||||||
trailing_sep_allowed: bool
|
pub trailing_sep_allowed: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {
|
pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {
|
||||||
|
|
|
@ -34,24 +34,24 @@ pub trait Reader {
|
||||||
|
|
||||||
#[deriving(Clone, Eq, Show)]
|
#[deriving(Clone, Eq, Show)]
|
||||||
pub struct TokenAndSpan {
|
pub struct TokenAndSpan {
|
||||||
tok: token::Token,
|
pub tok: token::Token,
|
||||||
sp: Span,
|
pub sp: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct StringReader<'a> {
|
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
|
// 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)
|
// 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
|
// The column of the next character to read
|
||||||
col: CharPos,
|
pub col: CharPos,
|
||||||
// The last character to be read
|
// The last character to be read
|
||||||
curr: Option<char>,
|
pub curr: Option<char>,
|
||||||
filemap: Rc<codemap::FileMap>,
|
pub filemap: Rc<codemap::FileMap>,
|
||||||
/* cached: */
|
/* cached: */
|
||||||
peek_tok: token::Token,
|
pub peek_tok: token::Token,
|
||||||
peek_span: Span,
|
pub peek_span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> StringReader<'a> {
|
impl<'a> StringReader<'a> {
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub mod obsolete;
|
||||||
|
|
||||||
// info about a parsing session.
|
// info about a parsing session.
|
||||||
pub struct ParseSess {
|
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
|
/// Used to determine and report recursive mod inclusions
|
||||||
included_mod_stack: RefCell<Vec<Path>>,
|
included_mod_stack: RefCell<Vec<Path>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ use parse::{new_sub_parser_from_file, ParseSess};
|
||||||
use owned_slice::OwnedSlice;
|
use owned_slice::OwnedSlice;
|
||||||
|
|
||||||
use collections::HashSet;
|
use collections::HashSet;
|
||||||
use std::kinds::marker;
|
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
@ -113,8 +112,8 @@ pub enum PathParsingMode {
|
||||||
|
|
||||||
/// A path paired with optional type bounds.
|
/// A path paired with optional type bounds.
|
||||||
pub struct PathAndBounds {
|
pub struct PathAndBounds {
|
||||||
path: ast::Path,
|
pub path: ast::Path,
|
||||||
bounds: Option<OwnedSlice<TyParamBound>>,
|
pub bounds: Option<OwnedSlice<TyParamBound>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ItemOrViewItem {
|
enum ItemOrViewItem {
|
||||||
|
@ -306,38 +305,35 @@ pub fn Parser<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, mut rdr: ~Reader:)
|
||||||
obsolete_set: HashSet::new(),
|
obsolete_set: HashSet::new(),
|
||||||
mod_path_stack: Vec::new(),
|
mod_path_stack: Vec::new(),
|
||||||
open_braces: Vec::new(),
|
open_braces: Vec::new(),
|
||||||
nocopy: marker::NoCopy
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Parser<'a> {
|
pub struct Parser<'a> {
|
||||||
sess: &'a ParseSess,
|
pub sess: &'a ParseSess,
|
||||||
cfg: CrateConfig,
|
|
||||||
// the current token:
|
// the current token:
|
||||||
token: token::Token,
|
pub token: token::Token,
|
||||||
// the span of the current token:
|
// the span of the current token:
|
||||||
span: Span,
|
pub span: Span,
|
||||||
// the span of the prior token:
|
// the span of the prior token:
|
||||||
last_span: Span,
|
pub last_span: Span,
|
||||||
|
pub cfg: CrateConfig,
|
||||||
// the previous token or None (only stashed sometimes).
|
// the previous token or None (only stashed sometimes).
|
||||||
last_token: Option<~token::Token>,
|
pub last_token: Option<~token::Token>,
|
||||||
buffer: [TokenAndSpan, ..4],
|
pub buffer: [TokenAndSpan, ..4],
|
||||||
buffer_start: int,
|
pub buffer_start: int,
|
||||||
buffer_end: int,
|
pub buffer_end: int,
|
||||||
tokens_consumed: uint,
|
pub tokens_consumed: uint,
|
||||||
restriction: restriction,
|
pub restriction: restriction,
|
||||||
quote_depth: uint, // not (yet) related to the quasiquoter
|
pub quote_depth: uint, // not (yet) related to the quasiquoter
|
||||||
reader: ~Reader:,
|
pub reader: ~Reader:,
|
||||||
interner: Rc<token::IdentInterner>,
|
pub interner: Rc<token::IdentInterner>,
|
||||||
/// The set of seen errors about obsolete syntax. Used to suppress
|
/// The set of seen errors about obsolete syntax. Used to suppress
|
||||||
/// extra detail when the same error is seen twice
|
/// 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
|
/// 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.
|
/// Stack of spans of open delimiters. Used for error message.
|
||||||
open_braces: Vec<Span> ,
|
pub open_braces: Vec<Span>,
|
||||||
/* do not copy the parser; its state is tied to outside state */
|
|
||||||
priv nocopy: marker::NoCopy
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_plain_ident_or_underscore(t: &token::Token) -> bool {
|
fn is_plain_ident_or_underscore(t: &token::Token) -> bool {
|
||||||
|
|
|
@ -556,7 +556,7 @@ pub fn get_ident_interner() -> Rc<IdentInterner> {
|
||||||
/// somehow.
|
/// somehow.
|
||||||
#[deriving(Clone, Eq, Hash, Ord, TotalEq, TotalOrd)]
|
#[deriving(Clone, Eq, Hash, Ord, TotalEq, TotalOrd)]
|
||||||
pub struct InternedString {
|
pub struct InternedString {
|
||||||
priv string: RcStr,
|
string: RcStr,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InternedString {
|
impl InternedString {
|
||||||
|
|
|
@ -257,7 +257,7 @@ pub fn mk_printer(out: ~io::Writer, linewidth: uint) -> Printer {
|
||||||
* called 'print'.
|
* called 'print'.
|
||||||
*/
|
*/
|
||||||
pub struct Printer {
|
pub struct Printer {
|
||||||
out: ~io::Writer,
|
pub out: ~io::Writer,
|
||||||
buf_len: uint,
|
buf_len: uint,
|
||||||
margin: int, // width of lines we're constrained to
|
margin: int, // width of lines we're constrained to
|
||||||
space: int, // number of spaces left on line
|
space: int, // number of spaces left on line
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub struct CurrentCommentAndLiteral {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct State<'a> {
|
pub struct State<'a> {
|
||||||
s: pp::Printer,
|
pub s: pp::Printer,
|
||||||
cm: Option<&'a CodeMap>,
|
cm: Option<&'a CodeMap>,
|
||||||
intr: Rc<token::IdentInterner>,
|
intr: Rc<token::IdentInterner>,
|
||||||
comments: Option<Vec<comments::Comment> >,
|
comments: Option<Vec<comments::Comment> >,
|
||||||
|
|
|
@ -23,8 +23,8 @@ use std::hash::Hash;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Interner<T> {
|
pub struct Interner<T> {
|
||||||
priv map: RefCell<HashMap<T, Name>>,
|
map: RefCell<HashMap<T, Name>>,
|
||||||
priv vect: RefCell<Vec<T> >,
|
vect: RefCell<Vec<T> >,
|
||||||
}
|
}
|
||||||
|
|
||||||
// when traits can extend traits, we should extend index<Name,T> to get []
|
// 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)]
|
#[deriving(Clone, Eq, Hash, Ord)]
|
||||||
pub struct RcStr {
|
pub struct RcStr {
|
||||||
priv string: Rc<~str>,
|
string: Rc<~str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TotalEq for RcStr {}
|
impl TotalEq for RcStr {}
|
||||||
|
@ -134,8 +134,8 @@ impl RcStr {
|
||||||
// A StrInterner differs from Interner<String> in that it accepts
|
// A StrInterner differs from Interner<String> in that it accepts
|
||||||
// &str rather than RcStr, resulting in less allocation.
|
// &str rather than RcStr, resulting in less allocation.
|
||||||
pub struct StrInterner {
|
pub struct StrInterner {
|
||||||
priv map: RefCell<HashMap<RcStr, Name>>,
|
map: RefCell<HashMap<RcStr, Name>>,
|
||||||
priv vect: RefCell<Vec<RcStr> >,
|
vect: RefCell<Vec<RcStr> >,
|
||||||
}
|
}
|
||||||
|
|
||||||
// when traits can extend traits, we should extend index<Name,T> to get []
|
// when traits can extend traits, we should extend index<Name,T> to get []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue