Renamed syntax::ast::ident -> Ident
This commit is contained in:
parent
1f4aba8cbf
commit
857f867320
56 changed files with 512 additions and 510 deletions
|
|
@ -25,10 +25,12 @@ use extra::serialize::{Encodable, Decodable, Encoder, Decoder};
|
|||
// macro expansion per Flatt et al., "Macros
|
||||
// That Work Together"
|
||||
#[deriving(Clone, Eq, IterBytes, ToStr)]
|
||||
pub struct ident { name: Name, ctxt: SyntaxContext }
|
||||
pub struct Ident { name: Name, ctxt: SyntaxContext }
|
||||
|
||||
/// Construct an identifier with the given name and an empty context:
|
||||
pub fn new_ident(name: Name) -> ident { ident {name: name, ctxt: empty_ctxt}}
|
||||
impl Ident {
|
||||
/// Construct an identifier with the given name and an empty context:
|
||||
pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: empty_ctxt}}
|
||||
}
|
||||
|
||||
/// A SyntaxContext represents a chain of macro-expandings
|
||||
/// and renamings. Each macro expansion corresponds to
|
||||
|
|
@ -48,7 +50,7 @@ pub type SyntaxContext = uint;
|
|||
pub struct SCTable {
|
||||
table : ~[SyntaxContext_],
|
||||
mark_memo : HashMap<(SyntaxContext,Mrk),SyntaxContext>,
|
||||
rename_memo : HashMap<(SyntaxContext,ident,Name),SyntaxContext>
|
||||
rename_memo : HashMap<(SyntaxContext,Ident,Name),SyntaxContext>
|
||||
}
|
||||
// NB: these must be placed in any SCTable...
|
||||
pub static empty_ctxt : uint = 0;
|
||||
|
|
@ -66,7 +68,7 @@ pub enum SyntaxContext_ {
|
|||
// "to" slot must have the same name and context
|
||||
// in the "from" slot. In essence, they're all
|
||||
// pointers to a single "rename" event node.
|
||||
Rename (ident,Name,SyntaxContext),
|
||||
Rename (Ident,Name,SyntaxContext),
|
||||
IllegalCtxt()
|
||||
}
|
||||
|
||||
|
|
@ -76,27 +78,27 @@ pub type Name = uint;
|
|||
/// A mark represents a unique id associated with a macro expansion
|
||||
pub type Mrk = uint;
|
||||
|
||||
impl<S:Encoder> Encodable<S> for ident {
|
||||
impl<S:Encoder> Encodable<S> for Ident {
|
||||
fn encode(&self, s: &mut S) {
|
||||
s.emit_str(interner_get(self.name));
|
||||
}
|
||||
}
|
||||
|
||||
#[deriving(IterBytes)]
|
||||
impl<D:Decoder> Decodable<D> for ident {
|
||||
fn decode(d: &mut D) -> ident {
|
||||
impl<D:Decoder> Decodable<D> for Ident {
|
||||
fn decode(d: &mut D) -> Ident {
|
||||
str_to_ident(d.read_str())
|
||||
}
|
||||
}
|
||||
|
||||
/// Function name (not all functions have names)
|
||||
pub type fn_ident = Option<ident>;
|
||||
pub type fn_ident = Option<Ident>;
|
||||
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct Lifetime {
|
||||
id: NodeId,
|
||||
span: Span,
|
||||
ident: ident
|
||||
ident: Ident
|
||||
}
|
||||
|
||||
// a "Path" is essentially Rust's notion of a name;
|
||||
|
|
@ -118,7 +120,7 @@ pub struct Path {
|
|||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct PathSegment {
|
||||
/// The identifier portion of this path segment.
|
||||
identifier: ident,
|
||||
identifier: Ident,
|
||||
/// The lifetime parameter for this path segment. Currently only one
|
||||
/// lifetime parameter is allowed.
|
||||
lifetime: Option<Lifetime>,
|
||||
|
|
@ -151,7 +153,7 @@ pub enum TyParamBound {
|
|||
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct TyParam {
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
id: NodeId,
|
||||
bounds: OptVec<TyParamBound>
|
||||
}
|
||||
|
|
@ -275,7 +277,7 @@ pub struct pat {
|
|||
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct field_pat {
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
pat: @pat,
|
||||
}
|
||||
|
||||
|
|
@ -430,7 +432,7 @@ pub struct arm {
|
|||
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct Field {
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
expr: @expr,
|
||||
span: Span,
|
||||
}
|
||||
|
|
@ -473,7 +475,7 @@ pub enum expr_ {
|
|||
expr_vstore(@expr, expr_vstore),
|
||||
expr_vec(~[@expr], mutability),
|
||||
expr_call(@expr, ~[@expr], CallSugar),
|
||||
expr_method_call(NodeId, @expr, ident, ~[Ty], ~[@expr], CallSugar),
|
||||
expr_method_call(NodeId, @expr, Ident, ~[Ty], ~[@expr], CallSugar),
|
||||
expr_tup(~[@expr]),
|
||||
expr_binary(NodeId, binop, @expr, @expr),
|
||||
expr_unary(NodeId, unop, @expr),
|
||||
|
|
@ -485,7 +487,7 @@ pub enum expr_ {
|
|||
/* Conditionless loop (can be exited with break, cont, or ret)
|
||||
Same semantics as while(true) { body }, but typestate knows that the
|
||||
(implicit) condition is always true. */
|
||||
expr_loop(Block, Option<ident>),
|
||||
expr_loop(Block, Option<Ident>),
|
||||
expr_match(@expr, ~[arm]),
|
||||
expr_fn_block(fn_decl, Block),
|
||||
expr_do_body(@expr),
|
||||
|
|
@ -493,15 +495,15 @@ pub enum expr_ {
|
|||
|
||||
expr_assign(@expr, @expr),
|
||||
expr_assign_op(NodeId, binop, @expr, @expr),
|
||||
expr_field(@expr, ident, ~[Ty]),
|
||||
expr_field(@expr, Ident, ~[Ty]),
|
||||
expr_index(NodeId, @expr, @expr),
|
||||
expr_path(Path),
|
||||
|
||||
/// The special identifier `self`.
|
||||
expr_self,
|
||||
expr_addr_of(mutability, @expr),
|
||||
expr_break(Option<ident>),
|
||||
expr_again(Option<ident>),
|
||||
expr_break(Option<Ident>),
|
||||
expr_again(Option<Ident>),
|
||||
expr_ret(Option<@expr>),
|
||||
expr_log(@expr, @expr),
|
||||
|
||||
|
|
@ -550,7 +552,7 @@ pub enum token_tree {
|
|||
tt_seq(Span, @mut ~[token_tree], Option<::parse::token::Token>, bool),
|
||||
|
||||
// a syntactic variable that will be filled in by macro expansion.
|
||||
tt_nonterminal(Span, ident)
|
||||
tt_nonterminal(Span, Ident)
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -615,7 +617,7 @@ pub enum matcher_ {
|
|||
// lo, hi position-in-match-array used:
|
||||
match_seq(~[matcher], Option<::parse::token::Token>, bool, uint, uint),
|
||||
// parse a Rust NT: name to bind, name of NT, position in match array:
|
||||
match_nonterminal(ident, ident, uint)
|
||||
match_nonterminal(Ident, Ident, uint)
|
||||
}
|
||||
|
||||
pub type mac = Spanned<mac_>;
|
||||
|
|
@ -649,14 +651,14 @@ pub struct mt {
|
|||
|
||||
#[deriving(Eq, Encodable, Decodable,IterBytes)]
|
||||
pub struct TypeField {
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
mt: mt,
|
||||
span: Span,
|
||||
}
|
||||
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct TypeMethod {
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
attrs: ~[Attribute],
|
||||
purity: purity,
|
||||
decl: fn_decl,
|
||||
|
|
@ -868,7 +870,7 @@ pub type explicit_self = Spanned<explicit_self_>;
|
|||
|
||||
#[deriving(Eq, Encodable, Decodable,IterBytes)]
|
||||
pub struct method {
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
attrs: ~[Attribute],
|
||||
generics: Generics,
|
||||
explicit_self: explicit_self,
|
||||
|
|
@ -921,7 +923,7 @@ pub struct enum_def {
|
|||
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct variant_ {
|
||||
name: ident,
|
||||
name: Ident,
|
||||
attrs: ~[Attribute],
|
||||
kind: variant_kind,
|
||||
id: NodeId,
|
||||
|
|
@ -933,7 +935,7 @@ pub type variant = Spanned<variant_>;
|
|||
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct path_list_ident_ {
|
||||
name: ident,
|
||||
name: Ident,
|
||||
id: NodeId,
|
||||
}
|
||||
|
||||
|
|
@ -949,7 +951,7 @@ pub enum view_path_ {
|
|||
// or just
|
||||
//
|
||||
// foo::bar::baz (with 'baz =' implicitly on the left)
|
||||
view_path_simple(ident, Path, NodeId),
|
||||
view_path_simple(Ident, Path, NodeId),
|
||||
|
||||
// foo::bar::*
|
||||
view_path_glob(Path, NodeId),
|
||||
|
|
@ -972,7 +974,7 @@ pub enum view_item_ {
|
|||
// optional @str: if present, this is a location (containing
|
||||
// arbitrary characters) from which to fetch the crate sources
|
||||
// For example, extern mod whatever = "github.com/mozilla/rust"
|
||||
view_item_extern_mod(ident, Option<@str>, ~[@MetaItem], NodeId),
|
||||
view_item_extern_mod(Ident, Option<@str>, ~[@MetaItem], NodeId),
|
||||
view_item_use(~[@view_path]),
|
||||
}
|
||||
|
||||
|
|
@ -1037,7 +1039,7 @@ pub type struct_field = Spanned<struct_field_>;
|
|||
|
||||
#[deriving(Eq, Encodable, Decodable,IterBytes)]
|
||||
pub enum struct_field_kind {
|
||||
named_field(ident, visibility),
|
||||
named_field(Ident, visibility),
|
||||
unnamed_field // element of a tuple-like struct
|
||||
}
|
||||
|
||||
|
|
@ -1055,7 +1057,7 @@ pub struct struct_def {
|
|||
*/
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
pub struct item {
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
attrs: ~[Attribute],
|
||||
id: NodeId,
|
||||
node: item_,
|
||||
|
|
@ -1083,7 +1085,7 @@ pub enum item_ {
|
|||
|
||||
#[deriving(Eq, Encodable, Decodable,IterBytes)]
|
||||
pub struct foreign_item {
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
attrs: ~[Attribute],
|
||||
node: foreign_item_,
|
||||
id: NodeId,
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ use std::vec;
|
|||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub enum path_elt {
|
||||
path_mod(ident),
|
||||
path_name(ident)
|
||||
path_mod(Ident),
|
||||
path_name(Ident)
|
||||
}
|
||||
|
||||
pub type path = ~[path_elt];
|
||||
|
|
@ -44,7 +44,7 @@ pub fn path_to_str_with_sep(p: &[path_elt], sep: &str, itr: @ident_interner)
|
|||
strs.connect(sep)
|
||||
}
|
||||
|
||||
pub fn path_ident_to_str(p: &path, i: ident, itr: @ident_interner) -> ~str {
|
||||
pub fn path_ident_to_str(p: &path, i: Ident, itr: @ident_interner) -> ~str {
|
||||
if p.is_empty() {
|
||||
itr.get(i.name).to_owned()
|
||||
} else {
|
||||
|
|
@ -74,7 +74,7 @@ pub enum ast_node {
|
|||
node_expr(@expr),
|
||||
node_stmt(@stmt),
|
||||
node_arg,
|
||||
node_local(ident),
|
||||
node_local(Ident),
|
||||
node_block(Block),
|
||||
node_struct_ctor(@struct_def, @item, @path),
|
||||
node_callee_scope(@expr)
|
||||
|
|
@ -89,7 +89,7 @@ pub struct Ctx {
|
|||
}
|
||||
|
||||
impl Ctx {
|
||||
fn extend(&self, elt: ident) -> @path {
|
||||
fn extend(&self, elt: Ident) -> @path {
|
||||
@vec::append(self.path.clone(), [path_name(elt)])
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ impl Ctx {
|
|||
fn map_struct_def(&mut self,
|
||||
struct_def: @ast::struct_def,
|
||||
parent_node: ast_node,
|
||||
ident: ast::ident) {
|
||||
ident: ast::Ident) {
|
||||
let p = self.extend(ident);
|
||||
|
||||
// If this is a tuple-like struct, register the constructor.
|
||||
|
|
@ -356,7 +356,7 @@ impl Visitor<()> for Ctx {
|
|||
|
||||
fn visit_struct_def(&mut self,
|
||||
struct_def: @struct_def,
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
generics: &Generics,
|
||||
node_id: NodeId,
|
||||
_: ()) {
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ use std::local_data;
|
|||
use std::num;
|
||||
use std::option;
|
||||
|
||||
pub fn path_name_i(idents: &[ident]) -> ~str {
|
||||
pub fn path_name_i(idents: &[Ident]) -> ~str {
|
||||
// FIXME: Bad copies (#2543 -- same for everything else that says "bad")
|
||||
idents.map(|i| token::interner_get(i.name)).connect("::")
|
||||
}
|
||||
|
||||
pub fn path_to_ident(path: &Path) -> ident {
|
||||
pub fn path_to_ident(path: &Path) -> Ident {
|
||||
path.segments.last().identifier
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ pub fn default_block(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn ident_to_path(s: Span, identifier: ident) -> Path {
|
||||
pub fn ident_to_path(s: Span, identifier: Ident) -> Path {
|
||||
ast::Path {
|
||||
span: s,
|
||||
global: false,
|
||||
|
|
@ -231,7 +231,7 @@ pub fn ident_to_path(s: Span, identifier: ident) -> Path {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn ident_to_pat(id: NodeId, s: Span, i: ident) -> @pat {
|
||||
pub fn ident_to_pat(id: NodeId, s: Span, i: Ident) -> @pat {
|
||||
@ast::pat { id: id,
|
||||
node: pat_ident(bind_infer, ident_to_path(s, i), None),
|
||||
span: s }
|
||||
|
|
@ -302,13 +302,13 @@ pub fn struct_field_visibility(field: ast::struct_field) -> visibility {
|
|||
}
|
||||
|
||||
pub trait inlined_item_utils {
|
||||
fn ident(&self) -> ident;
|
||||
fn ident(&self) -> Ident;
|
||||
fn id(&self) -> ast::NodeId;
|
||||
fn accept<E: Clone, V:Visitor<E>>(&self, e: E, v: &mut V);
|
||||
}
|
||||
|
||||
impl inlined_item_utils for inlined_item {
|
||||
fn ident(&self) -> ident {
|
||||
fn ident(&self) -> Ident {
|
||||
match *self {
|
||||
ii_item(i) => i.ident,
|
||||
ii_foreign(i) => i.ident,
|
||||
|
|
@ -608,7 +608,7 @@ impl Visitor<()> for IdVisitor {
|
|||
// XXX: Default
|
||||
fn visit_struct_def(&mut self,
|
||||
struct_definition: @struct_def,
|
||||
identifier: ident,
|
||||
identifier: Ident,
|
||||
generics: &Generics,
|
||||
node_id: NodeId,
|
||||
env: ()) {
|
||||
|
|
@ -749,7 +749,7 @@ impl SimpleVisitor for EachViewItemData {
|
|||
}
|
||||
fn visit_struct_def(&mut self,
|
||||
_: @struct_def,
|
||||
_: ident,
|
||||
_: Ident,
|
||||
_: &Generics,
|
||||
_: NodeId) {
|
||||
// XXX: Default method.
|
||||
|
|
@ -827,7 +827,7 @@ pub fn pat_is_ident(pat: @ast::pat) -> bool {
|
|||
// HYGIENE FUNCTIONS
|
||||
|
||||
/// Construct an identifier with the given name and an empty context:
|
||||
pub fn new_ident(name: Name) -> ident { ident {name: name, ctxt: 0}}
|
||||
pub fn new_ident(name: Name) -> Ident { Ident {name: name, ctxt: 0}}
|
||||
|
||||
/// Extend a syntax context with a given mark
|
||||
pub fn new_mark(m:Mrk, tail:SyntaxContext) -> SyntaxContext {
|
||||
|
|
@ -859,13 +859,13 @@ pub fn new_mark_internal(m:Mrk, tail:SyntaxContext,table:&mut SCTable)
|
|||
}
|
||||
|
||||
/// Extend a syntax context with a given rename
|
||||
pub fn new_rename(id:ident, to:Name, tail:SyntaxContext) -> SyntaxContext {
|
||||
pub fn new_rename(id:Ident, to:Name, tail:SyntaxContext) -> SyntaxContext {
|
||||
new_rename_internal(id, to, tail, get_sctable())
|
||||
}
|
||||
|
||||
// Extend a syntax context with a given rename and sctable
|
||||
// FIXME #4536 : currently pub to allow testing
|
||||
pub fn new_rename_internal(id:ident, to:Name, tail:SyntaxContext, table: &mut SCTable)
|
||||
pub fn new_rename_internal(id:Ident, to:Name, tail:SyntaxContext, table: &mut SCTable)
|
||||
-> SyntaxContext {
|
||||
let key = (tail,id,to);
|
||||
// FIXME #5074
|
||||
|
|
@ -916,22 +916,22 @@ fn idx_push<T>(vec: &mut ~[T], val: T) -> uint {
|
|||
}
|
||||
|
||||
/// Resolve a syntax object to a name, per MTWT.
|
||||
pub fn resolve(id : ident) -> Name {
|
||||
pub fn resolve(id : Ident) -> Name {
|
||||
resolve_internal(id, get_sctable())
|
||||
}
|
||||
|
||||
// Resolve a syntax object to a name, per MTWT.
|
||||
// FIXME #4536 : currently pub to allow testing
|
||||
pub fn resolve_internal(id : ident, table : &mut SCTable) -> Name {
|
||||
pub fn resolve_internal(id : Ident, table : &mut SCTable) -> Name {
|
||||
match table.table[id.ctxt] {
|
||||
EmptyCtxt => id.name,
|
||||
// ignore marks here:
|
||||
Mark(_,subctxt) => resolve_internal(ident{name:id.name, ctxt: subctxt},table),
|
||||
Mark(_,subctxt) => resolve_internal(Ident{name:id.name, ctxt: subctxt},table),
|
||||
// do the rename if necessary:
|
||||
Rename(ident{name,ctxt},toname,subctxt) => {
|
||||
Rename(Ident{name,ctxt},toname,subctxt) => {
|
||||
// this could be cached or computed eagerly:
|
||||
let resolvedfrom = resolve_internal(ident{name:name,ctxt:ctxt},table);
|
||||
let resolvedthis = resolve_internal(ident{name:id.name,ctxt:subctxt},table);
|
||||
let resolvedfrom = resolve_internal(Ident{name:name,ctxt:ctxt},table);
|
||||
let resolvedthis = resolve_internal(Ident{name:id.name,ctxt:subctxt},table);
|
||||
if ((resolvedthis == resolvedfrom)
|
||||
&& (marksof(ctxt,resolvedthis,table)
|
||||
== marksof(subctxt,resolvedthis,table))) {
|
||||
|
|
@ -1014,12 +1014,12 @@ mod test {
|
|||
|
||||
// convert a list of uints to an @[ident]
|
||||
// (ignores the interner completely)
|
||||
fn uints_to_idents (uints: &~[uint]) -> @~[ident] {
|
||||
@uints.map(|u| ident {name:*u, ctxt: empty_ctxt})
|
||||
fn uints_to_idents (uints: &~[uint]) -> @~[Ident] {
|
||||
@uints.map(|u| Ident {name:*u, ctxt: empty_ctxt})
|
||||
}
|
||||
|
||||
fn id (u : uint, s: SyntaxContext) -> ident {
|
||||
ident{name:u, ctxt: s}
|
||||
fn id (u : uint, s: SyntaxContext) -> Ident {
|
||||
Ident{name:u, ctxt: s}
|
||||
}
|
||||
|
||||
// because of the SCTable, I now need a tidy way of
|
||||
|
|
@ -1027,7 +1027,7 @@ mod test {
|
|||
#[deriving(Clone, Eq)]
|
||||
enum TestSC {
|
||||
M(Mrk),
|
||||
R(ident,Name)
|
||||
R(Ident,Name)
|
||||
}
|
||||
|
||||
// unfold a vector of TestSC values into a SCTable,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ pub struct SyntaxExpanderTTItem {
|
|||
|
||||
pub type SyntaxExpanderTTItemFun = @fn(@ExtCtxt,
|
||||
Span,
|
||||
ast::ident,
|
||||
ast::Ident,
|
||||
~[ast::token_tree])
|
||||
-> MacResult;
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ pub struct BlockInfo {
|
|||
}
|
||||
|
||||
// a list of ident->name renamings
|
||||
type RenameList = ~[(ast::ident,Name)];
|
||||
type RenameList = ~[(ast::Ident,Name)];
|
||||
|
||||
// The base map of methods for expanding syntax extension
|
||||
// AST nodes into full ASTs
|
||||
|
|
@ -228,7 +228,7 @@ pub struct ExtCtxt {
|
|||
// and there are bugs in the code for object
|
||||
// types that make this hard to get right at the
|
||||
// moment. - nmatsakis
|
||||
mod_path: @mut ~[ast::ident],
|
||||
mod_path: @mut ~[ast::Ident],
|
||||
trace_mac: @mut bool
|
||||
}
|
||||
|
||||
|
|
@ -255,9 +255,9 @@ impl ExtCtxt {
|
|||
}
|
||||
pub fn print_backtrace(&self) { }
|
||||
pub fn backtrace(&self) -> Option<@ExpnInfo> { *self.backtrace }
|
||||
pub fn mod_push(&self, i: ast::ident) { self.mod_path.push(i); }
|
||||
pub fn mod_push(&self, i: ast::Ident) { self.mod_path.push(i); }
|
||||
pub fn mod_pop(&self) { self.mod_path.pop(); }
|
||||
pub fn mod_path(&self) -> ~[ast::ident] { (*self.mod_path).clone() }
|
||||
pub fn mod_path(&self) -> ~[ast::Ident] { (*self.mod_path).clone() }
|
||||
pub fn bt_push(&self, ei: codemap::ExpnInfo) {
|
||||
match ei {
|
||||
ExpnInfo {call_site: cs, callee: ref callee} => {
|
||||
|
|
@ -311,10 +311,10 @@ impl ExtCtxt {
|
|||
pub fn set_trace_macros(&self, x: bool) {
|
||||
*self.trace_mac = x
|
||||
}
|
||||
pub fn str_of(&self, id: ast::ident) -> @str {
|
||||
pub fn str_of(&self, id: ast::Ident) -> @str {
|
||||
ident_to_str(&id)
|
||||
}
|
||||
pub fn ident_of(&self, st: &str) -> ast::ident {
|
||||
pub fn ident_of(&self, st: &str) -> ast::Ident {
|
||||
str_to_ident(st)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
use abi::AbiSet;
|
||||
use ast::ident;
|
||||
use ast::Ident;
|
||||
use ast;
|
||||
use ast_util;
|
||||
use codemap::{Span, respan, dummy_sp};
|
||||
|
|
@ -20,7 +20,7 @@ use opt_vec;
|
|||
use opt_vec::OptVec;
|
||||
|
||||
pub struct Field {
|
||||
ident: ast::ident,
|
||||
ident: ast::Ident,
|
||||
ex: @ast::expr
|
||||
}
|
||||
|
||||
|
|
@ -32,12 +32,12 @@ mod syntax {
|
|||
|
||||
pub trait AstBuilder {
|
||||
// paths
|
||||
fn path(&self, span: Span, strs: ~[ast::ident]) -> ast::Path;
|
||||
fn path_ident(&self, span: Span, id: ast::ident) -> ast::Path;
|
||||
fn path_global(&self, span: Span, strs: ~[ast::ident]) -> ast::Path;
|
||||
fn path(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path;
|
||||
fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path;
|
||||
fn path_global(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path;
|
||||
fn path_all(&self, sp: Span,
|
||||
global: bool,
|
||||
idents: ~[ast::ident],
|
||||
idents: ~[ast::Ident],
|
||||
rp: Option<ast::Lifetime>,
|
||||
types: ~[ast::Ty])
|
||||
-> ast::Path;
|
||||
|
|
@ -47,7 +47,7 @@ pub trait AstBuilder {
|
|||
|
||||
fn ty(&self, span: Span, ty: ast::ty_) -> ast::Ty;
|
||||
fn ty_path(&self, ast::Path, Option<OptVec<ast::TyParamBound>>) -> ast::Ty;
|
||||
fn ty_ident(&self, span: Span, idents: ast::ident) -> ast::Ty;
|
||||
fn ty_ident(&self, span: Span, idents: ast::Ident) -> ast::Ty;
|
||||
|
||||
fn ty_rptr(&self, span: Span,
|
||||
ty: ast::Ty,
|
||||
|
|
@ -62,22 +62,22 @@ pub trait AstBuilder {
|
|||
|
||||
fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty];
|
||||
fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty];
|
||||
fn ty_field_imm(&self, span: Span, name: ident, ty: ast::Ty) -> ast::TypeField;
|
||||
fn ty_field_imm(&self, span: Span, name: Ident, ty: ast::Ty) -> ast::TypeField;
|
||||
fn strip_bounds(&self, bounds: &Generics) -> Generics;
|
||||
|
||||
fn typaram(&self, id: ast::ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam;
|
||||
fn typaram(&self, id: ast::Ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam;
|
||||
|
||||
fn trait_ref(&self, path: ast::Path) -> ast::trait_ref;
|
||||
fn typarambound(&self, path: ast::Path) -> ast::TyParamBound;
|
||||
fn lifetime(&self, span: Span, ident: ast::ident) -> ast::Lifetime;
|
||||
fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime;
|
||||
|
||||
// statements
|
||||
fn stmt_expr(&self, expr: @ast::expr) -> @ast::stmt;
|
||||
fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt;
|
||||
fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: @ast::expr) -> @ast::stmt;
|
||||
fn stmt_let_typed(&self,
|
||||
sp: Span,
|
||||
mutbl: bool,
|
||||
ident: ast::ident,
|
||||
ident: ast::Ident,
|
||||
typ: ast::Ty,
|
||||
ex: @ast::expr)
|
||||
-> @ast::stmt;
|
||||
|
|
@ -93,7 +93,7 @@ pub trait AstBuilder {
|
|||
// expressions
|
||||
fn expr(&self, span: Span, node: ast::expr_) -> @ast::expr;
|
||||
fn expr_path(&self, path: ast::Path) -> @ast::expr;
|
||||
fn expr_ident(&self, span: Span, id: ast::ident) -> @ast::expr;
|
||||
fn expr_ident(&self, span: Span, id: ast::Ident) -> @ast::expr;
|
||||
|
||||
fn expr_self(&self, span: Span) -> @ast::expr;
|
||||
fn expr_binary(&self, sp: Span, op: ast::binop,
|
||||
|
|
@ -104,19 +104,19 @@ pub trait AstBuilder {
|
|||
fn expr_managed(&self, sp: Span, e: @ast::expr) -> @ast::expr;
|
||||
fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr;
|
||||
fn expr_mut_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr;
|
||||
fn expr_field_access(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr;
|
||||
fn expr_field_access(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr;
|
||||
fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr;
|
||||
fn expr_call_ident(&self, span: Span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr;
|
||||
fn expr_call_global(&self, sp: Span, fn_path: ~[ast::ident],
|
||||
fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::expr]) -> @ast::expr;
|
||||
fn expr_call_global(&self, sp: Span, fn_path: ~[ast::Ident],
|
||||
args: ~[@ast::expr]) -> @ast::expr;
|
||||
fn expr_method_call(&self, span: Span,
|
||||
expr: @ast::expr, ident: ast::ident,
|
||||
expr: @ast::expr, ident: ast::Ident,
|
||||
args: ~[@ast::expr]) -> @ast::expr;
|
||||
fn expr_block(&self, b: ast::Block) -> @ast::expr;
|
||||
|
||||
fn field_imm(&self, span: Span, name: ident, e: @ast::expr) -> ast::Field;
|
||||
fn field_imm(&self, span: Span, name: Ident, e: @ast::expr) -> ast::Field;
|
||||
fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr;
|
||||
fn expr_struct_ident(&self, span: Span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr;
|
||||
fn expr_struct_ident(&self, span: Span, id: ast::Ident, fields: ~[ast::Field]) -> @ast::expr;
|
||||
|
||||
fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::expr;
|
||||
|
||||
|
|
@ -137,11 +137,11 @@ pub trait AstBuilder {
|
|||
fn pat(&self, span: Span, pat: ast::pat_) -> @ast::pat;
|
||||
fn pat_wild(&self, span: Span) -> @ast::pat;
|
||||
fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat;
|
||||
fn pat_ident(&self, span: Span, ident: ast::ident) -> @ast::pat;
|
||||
fn pat_ident(&self, span: Span, ident: ast::Ident) -> @ast::pat;
|
||||
|
||||
fn pat_ident_binding_mode(&self,
|
||||
span: Span,
|
||||
ident: ast::ident,
|
||||
ident: ast::Ident,
|
||||
bm: ast::binding_mode) -> @ast::pat;
|
||||
fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat;
|
||||
fn pat_struct(&self, span: Span,
|
||||
|
|
@ -156,65 +156,65 @@ pub trait AstBuilder {
|
|||
|
||||
fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr;
|
||||
|
||||
fn lambda(&self, span: Span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr;
|
||||
fn lambda(&self, span: Span, ids: ~[ast::Ident], blk: ast::Block) -> @ast::expr;
|
||||
fn lambda0(&self, span: Span, blk: ast::Block) -> @ast::expr;
|
||||
fn lambda1(&self, span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr;
|
||||
fn lambda1(&self, span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr;
|
||||
|
||||
fn lambda_expr(&self, span: Span, ids: ~[ast::ident], blk: @ast::expr) -> @ast::expr;
|
||||
fn lambda_expr(&self, span: Span, ids: ~[ast::Ident], blk: @ast::expr) -> @ast::expr;
|
||||
fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr;
|
||||
fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr;
|
||||
fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr;
|
||||
|
||||
fn lambda_stmts(&self, span: Span, ids: ~[ast::ident], blk: ~[@ast::stmt]) -> @ast::expr;
|
||||
fn lambda_stmts(&self, span: Span, ids: ~[ast::Ident], blk: ~[@ast::stmt]) -> @ast::expr;
|
||||
fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr;
|
||||
fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr;
|
||||
fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::Ident) -> @ast::expr;
|
||||
|
||||
// items
|
||||
fn item(&self, span: Span,
|
||||
name: ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item;
|
||||
name: Ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item;
|
||||
|
||||
fn arg(&self, span: Span, name: ident, ty: ast::Ty) -> ast::arg;
|
||||
fn arg(&self, span: Span, name: Ident, ty: ast::Ty) -> ast::arg;
|
||||
// XXX unused self
|
||||
fn fn_decl(&self, inputs: ~[ast::arg], output: ast::Ty) -> ast::fn_decl;
|
||||
|
||||
fn item_fn_poly(&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
inputs: ~[ast::arg],
|
||||
output: ast::Ty,
|
||||
generics: Generics,
|
||||
body: ast::Block) -> @ast::item;
|
||||
fn item_fn(&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
inputs: ~[ast::arg],
|
||||
output: ast::Ty,
|
||||
body: ast::Block) -> @ast::item;
|
||||
|
||||
fn variant(&self, span: Span, name: ident, tys: ~[ast::Ty]) -> ast::variant;
|
||||
fn variant(&self, span: Span, name: Ident, tys: ~[ast::Ty]) -> ast::variant;
|
||||
fn item_enum_poly(&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
enum_definition: ast::enum_def,
|
||||
generics: Generics) -> @ast::item;
|
||||
fn item_enum(&self, span: Span, name: ident, enum_def: ast::enum_def) -> @ast::item;
|
||||
fn item_enum(&self, span: Span, name: Ident, enum_def: ast::enum_def) -> @ast::item;
|
||||
|
||||
fn item_struct_poly(&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
struct_def: ast::struct_def,
|
||||
generics: Generics) -> @ast::item;
|
||||
fn item_struct(&self, span: Span, name: ident, struct_def: ast::struct_def) -> @ast::item;
|
||||
fn item_struct(&self, span: Span, name: Ident, struct_def: ast::struct_def) -> @ast::item;
|
||||
|
||||
fn item_mod(&self, span: Span,
|
||||
name: ident, attrs: ~[ast::Attribute],
|
||||
name: Ident, attrs: ~[ast::Attribute],
|
||||
vi: ~[ast::view_item], items: ~[@ast::item]) -> @ast::item;
|
||||
|
||||
fn item_ty_poly(&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
ty: ast::Ty,
|
||||
generics: Generics) -> @ast::item;
|
||||
fn item_ty(&self, span: Span, name: ident, ty: ast::Ty) -> @ast::item;
|
||||
fn item_ty(&self, span: Span, name: Ident, ty: ast::Ty) -> @ast::item;
|
||||
|
||||
fn attribute(&self, sp: Span, mi: @ast::MetaItem) -> ast::Attribute;
|
||||
|
||||
|
|
@ -225,25 +225,25 @@ pub trait AstBuilder {
|
|||
fn view_use(&self, sp: Span,
|
||||
vis: ast::visibility, vp: ~[@ast::view_path]) -> ast::view_item;
|
||||
fn view_use_list(&self, sp: Span, vis: ast::visibility,
|
||||
path: ~[ast::ident], imports: &[ast::ident]) -> ast::view_item;
|
||||
path: ~[ast::Ident], imports: &[ast::Ident]) -> ast::view_item;
|
||||
fn view_use_glob(&self, sp: Span,
|
||||
vis: ast::visibility, path: ~[ast::ident]) -> ast::view_item;
|
||||
vis: ast::visibility, path: ~[ast::Ident]) -> ast::view_item;
|
||||
}
|
||||
|
||||
impl AstBuilder for @ExtCtxt {
|
||||
fn path(&self, span: Span, strs: ~[ast::ident]) -> ast::Path {
|
||||
fn path(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path {
|
||||
self.path_all(span, false, strs, None, ~[])
|
||||
}
|
||||
fn path_ident(&self, span: Span, id: ast::ident) -> ast::Path {
|
||||
fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
|
||||
self.path(span, ~[id])
|
||||
}
|
||||
fn path_global(&self, span: Span, strs: ~[ast::ident]) -> ast::Path {
|
||||
fn path_global(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path {
|
||||
self.path_all(span, true, strs, None, ~[])
|
||||
}
|
||||
fn path_all(&self,
|
||||
sp: Span,
|
||||
global: bool,
|
||||
mut idents: ~[ast::ident],
|
||||
mut idents: ~[ast::Ident],
|
||||
rp: Option<ast::Lifetime>,
|
||||
types: ~[ast::Ty])
|
||||
-> ast::Path {
|
||||
|
|
@ -291,7 +291,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
|
||||
// Might need to take bounds as an argument in the future, if you ever want
|
||||
// to generate a bounded existential trait type.
|
||||
fn ty_ident(&self, span: Span, ident: ast::ident)
|
||||
fn ty_ident(&self, span: Span, ident: ast::Ident)
|
||||
-> ast::Ty {
|
||||
self.ty_path(self.path_ident(span, ident), None)
|
||||
}
|
||||
|
|
@ -326,7 +326,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
~[ ty ]), None)
|
||||
}
|
||||
|
||||
fn ty_field_imm(&self, span: Span, name: ident, ty: ast::Ty) -> ast::TypeField {
|
||||
fn ty_field_imm(&self, span: Span, name: Ident, ty: ast::Ty) -> ast::TypeField {
|
||||
ast::TypeField {
|
||||
ident: name,
|
||||
mt: ast::mt { ty: ~ty, mutbl: ast::m_imm },
|
||||
|
|
@ -346,7 +346,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
}
|
||||
}
|
||||
|
||||
fn typaram(&self, id: ast::ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam {
|
||||
fn typaram(&self, id: ast::Ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam {
|
||||
ast::TyParam { ident: id, id: self.next_id(), bounds: bounds }
|
||||
}
|
||||
|
||||
|
|
@ -385,7 +385,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
ast::TraitTyParamBound(self.trait_ref(path))
|
||||
}
|
||||
|
||||
fn lifetime(&self, span: Span, ident: ast::ident) -> ast::Lifetime {
|
||||
fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime {
|
||||
ast::Lifetime { id: self.next_id(), span: span, ident: ident }
|
||||
}
|
||||
|
||||
|
|
@ -393,7 +393,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
@respan(expr.span, ast::stmt_semi(expr, self.next_id()))
|
||||
}
|
||||
|
||||
fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt {
|
||||
fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: @ast::expr) -> @ast::stmt {
|
||||
let pat = self.pat_ident(sp, ident);
|
||||
let local = @ast::Local {
|
||||
is_mutbl: mutbl,
|
||||
|
|
@ -410,7 +410,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
fn stmt_let_typed(&self,
|
||||
sp: Span,
|
||||
mutbl: bool,
|
||||
ident: ast::ident,
|
||||
ident: ast::Ident,
|
||||
typ: ast::Ty,
|
||||
ex: @ast::expr)
|
||||
-> @ast::stmt {
|
||||
|
|
@ -461,7 +461,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
self.expr(path.span, ast::expr_path(path))
|
||||
}
|
||||
|
||||
fn expr_ident(&self, span: Span, id: ast::ident) -> @ast::expr {
|
||||
fn expr_ident(&self, span: Span, id: ast::Ident) -> @ast::expr {
|
||||
self.expr_path(self.path_ident(span, id))
|
||||
}
|
||||
fn expr_self(&self, span: Span) -> @ast::expr {
|
||||
|
|
@ -485,7 +485,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
self.expr_unary(sp, ast::box(ast::m_imm), e)
|
||||
}
|
||||
|
||||
fn expr_field_access(&self, sp: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr {
|
||||
fn expr_field_access(&self, sp: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr {
|
||||
self.expr(sp, ast::expr_field(expr, ident, ~[]))
|
||||
}
|
||||
fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr {
|
||||
|
|
@ -498,18 +498,18 @@ impl AstBuilder for @ExtCtxt {
|
|||
fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr {
|
||||
self.expr(span, ast::expr_call(expr, args, ast::NoSugar))
|
||||
}
|
||||
fn expr_call_ident(&self, span: Span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr {
|
||||
fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::expr]) -> @ast::expr {
|
||||
self.expr(span,
|
||||
ast::expr_call(self.expr_ident(span, id), args, ast::NoSugar))
|
||||
}
|
||||
fn expr_call_global(&self, sp: Span, fn_path: ~[ast::ident],
|
||||
fn expr_call_global(&self, sp: Span, fn_path: ~[ast::Ident],
|
||||
args: ~[@ast::expr]) -> @ast::expr {
|
||||
let pathexpr = self.expr_path(self.path_global(sp, fn_path));
|
||||
self.expr_call(sp, pathexpr, args)
|
||||
}
|
||||
fn expr_method_call(&self, span: Span,
|
||||
expr: @ast::expr,
|
||||
ident: ast::ident,
|
||||
ident: ast::Ident,
|
||||
args: ~[@ast::expr]) -> @ast::expr {
|
||||
self.expr(span,
|
||||
ast::expr_method_call(self.next_id(), expr, ident, ~[], args, ast::NoSugar))
|
||||
|
|
@ -517,14 +517,14 @@ impl AstBuilder for @ExtCtxt {
|
|||
fn expr_block(&self, b: ast::Block) -> @ast::expr {
|
||||
self.expr(b.span, ast::expr_block(b))
|
||||
}
|
||||
fn field_imm(&self, span: Span, name: ident, e: @ast::expr) -> ast::Field {
|
||||
fn field_imm(&self, span: Span, name: Ident, e: @ast::expr) -> ast::Field {
|
||||
ast::Field { ident: name, expr: e, span: span }
|
||||
}
|
||||
fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr {
|
||||
self.expr(span, ast::expr_struct(path, fields, None))
|
||||
}
|
||||
fn expr_struct_ident(&self, span: Span,
|
||||
id: ast::ident, fields: ~[ast::Field]) -> @ast::expr {
|
||||
id: ast::Ident, fields: ~[ast::Field]) -> @ast::expr {
|
||||
self.expr_struct(span, self.path_ident(span, id), fields)
|
||||
}
|
||||
|
||||
|
|
@ -591,13 +591,13 @@ impl AstBuilder for @ExtCtxt {
|
|||
fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat {
|
||||
self.pat(span, ast::pat_lit(expr))
|
||||
}
|
||||
fn pat_ident(&self, span: Span, ident: ast::ident) -> @ast::pat {
|
||||
fn pat_ident(&self, span: Span, ident: ast::Ident) -> @ast::pat {
|
||||
self.pat_ident_binding_mode(span, ident, ast::bind_infer)
|
||||
}
|
||||
|
||||
fn pat_ident_binding_mode(&self,
|
||||
span: Span,
|
||||
ident: ast::ident,
|
||||
ident: ast::Ident,
|
||||
bm: ast::binding_mode) -> @ast::pat {
|
||||
let path = self.path_ident(span, ident);
|
||||
let pat = ast::pat_ident(bm, path, None);
|
||||
|
|
@ -638,7 +638,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr {
|
||||
self.expr(span, ast::expr_fn_block(fn_decl, blk))
|
||||
}
|
||||
fn lambda(&self, span: Span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr {
|
||||
fn lambda(&self, span: Span, ids: ~[ast::Ident], blk: ast::Block) -> @ast::expr {
|
||||
let fn_decl = self.fn_decl(
|
||||
ids.map(|id| self.arg(span, *id, self.ty_infer(span))),
|
||||
self.ty_infer(span));
|
||||
|
|
@ -658,38 +658,38 @@ impl AstBuilder for @ExtCtxt {
|
|||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr {
|
||||
fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr {
|
||||
let ext_cx = *self;
|
||||
let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
|
||||
quote_expr!(|$ident| $blk_e )
|
||||
}
|
||||
#[cfg(not(stage0))]
|
||||
fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr {
|
||||
fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr {
|
||||
let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
|
||||
quote_expr!(*self, |$ident| $blk_e )
|
||||
}
|
||||
|
||||
fn lambda_expr(&self, span: Span, ids: ~[ast::ident], expr: @ast::expr) -> @ast::expr {
|
||||
fn lambda_expr(&self, span: Span, ids: ~[ast::Ident], expr: @ast::expr) -> @ast::expr {
|
||||
self.lambda(span, ids, self.block_expr(expr))
|
||||
}
|
||||
fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr {
|
||||
self.lambda0(span, self.block_expr(expr))
|
||||
}
|
||||
fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr {
|
||||
fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr {
|
||||
self.lambda1(span, self.block_expr(expr), ident)
|
||||
}
|
||||
|
||||
fn lambda_stmts(&self, span: Span, ids: ~[ast::ident], stmts: ~[@ast::stmt]) -> @ast::expr {
|
||||
fn lambda_stmts(&self, span: Span, ids: ~[ast::Ident], stmts: ~[@ast::stmt]) -> @ast::expr {
|
||||
self.lambda(span, ids, self.block(span, stmts, None))
|
||||
}
|
||||
fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr {
|
||||
self.lambda0(span, self.block(span, stmts, None))
|
||||
}
|
||||
fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr {
|
||||
fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::Ident) -> @ast::expr {
|
||||
self.lambda1(span, self.block(span, stmts, None), ident)
|
||||
}
|
||||
|
||||
fn arg(&self, span: Span, ident: ast::ident, ty: ast::Ty) -> ast::arg {
|
||||
fn arg(&self, span: Span, ident: ast::Ident, ty: ast::Ty) -> ast::arg {
|
||||
let arg_pat = self.pat_ident(span, ident);
|
||||
ast::arg {
|
||||
is_mutbl: false,
|
||||
|
|
@ -709,7 +709,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
}
|
||||
|
||||
fn item(&self, span: Span,
|
||||
name: ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item {
|
||||
name: Ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item {
|
||||
// XXX: Would be nice if our generated code didn't violate
|
||||
// Rust coding conventions
|
||||
@ast::item { ident: name,
|
||||
|
|
@ -722,7 +722,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
|
||||
fn item_fn_poly(&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
inputs: ~[ast::arg],
|
||||
output: ast::Ty,
|
||||
generics: Generics,
|
||||
|
|
@ -739,7 +739,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
|
||||
fn item_fn(&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
inputs: ~[ast::arg],
|
||||
output: ast::Ty,
|
||||
body: ast::Block
|
||||
|
|
@ -753,7 +753,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
body)
|
||||
}
|
||||
|
||||
fn variant(&self, span: Span, name: ident, tys: ~[ast::Ty]) -> ast::variant {
|
||||
fn variant(&self, span: Span, name: Ident, tys: ~[ast::Ty]) -> ast::variant {
|
||||
let args = tys.move_iter().map(|ty| {
|
||||
ast::variant_arg { ty: ty, id: self.next_id() }
|
||||
}).collect();
|
||||
|
|
@ -769,13 +769,13 @@ impl AstBuilder for @ExtCtxt {
|
|||
})
|
||||
}
|
||||
|
||||
fn item_enum_poly(&self, span: Span, name: ident,
|
||||
fn item_enum_poly(&self, span: Span, name: Ident,
|
||||
enum_definition: ast::enum_def,
|
||||
generics: Generics) -> @ast::item {
|
||||
self.item(span, name, ~[], ast::item_enum(enum_definition, generics))
|
||||
}
|
||||
|
||||
fn item_enum(&self, span: Span, name: ident,
|
||||
fn item_enum(&self, span: Span, name: Ident,
|
||||
enum_definition: ast::enum_def) -> @ast::item {
|
||||
self.item_enum_poly(span, name, enum_definition,
|
||||
ast_util::empty_generics())
|
||||
|
|
@ -784,7 +784,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
fn item_struct(
|
||||
&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
struct_def: ast::struct_def
|
||||
) -> @ast::item {
|
||||
self.item_struct_poly(
|
||||
|
|
@ -798,14 +798,14 @@ impl AstBuilder for @ExtCtxt {
|
|||
fn item_struct_poly(
|
||||
&self,
|
||||
span: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
struct_def: ast::struct_def,
|
||||
generics: Generics
|
||||
) -> @ast::item {
|
||||
self.item(span, name, ~[], ast::item_struct(@struct_def, generics))
|
||||
}
|
||||
|
||||
fn item_mod(&self, span: Span, name: ident,
|
||||
fn item_mod(&self, span: Span, name: Ident,
|
||||
attrs: ~[ast::Attribute],
|
||||
vi: ~[ast::view_item],
|
||||
items: ~[@ast::item]) -> @ast::item {
|
||||
|
|
@ -820,12 +820,12 @@ impl AstBuilder for @ExtCtxt {
|
|||
)
|
||||
}
|
||||
|
||||
fn item_ty_poly(&self, span: Span, name: ident, ty: ast::Ty,
|
||||
fn item_ty_poly(&self, span: Span, name: Ident, ty: ast::Ty,
|
||||
generics: Generics) -> @ast::item {
|
||||
self.item(span, name, ~[], ast::item_ty(ty, generics))
|
||||
}
|
||||
|
||||
fn item_ty(&self, span: Span, name: ident, ty: ast::Ty) -> @ast::item {
|
||||
fn item_ty(&self, span: Span, name: Ident, ty: ast::Ty) -> @ast::item {
|
||||
self.item_ty_poly(span, name, ty, ast_util::empty_generics())
|
||||
}
|
||||
|
||||
|
|
@ -858,7 +858,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
}
|
||||
|
||||
fn view_use_list(&self, sp: Span, vis: ast::visibility,
|
||||
path: ~[ast::ident], imports: &[ast::ident]) -> ast::view_item {
|
||||
path: ~[ast::Ident], imports: &[ast::Ident]) -> ast::view_item {
|
||||
let imports = do imports.map |id| {
|
||||
respan(sp, ast::path_list_ident_ { name: *id, id: self.next_id() })
|
||||
};
|
||||
|
|
@ -871,7 +871,7 @@ impl AstBuilder for @ExtCtxt {
|
|||
}
|
||||
|
||||
fn view_use_glob(&self, sp: Span,
|
||||
vis: ast::visibility, path: ~[ast::ident]) -> ast::view_item {
|
||||
vis: ast::visibility, path: ~[ast::Ident]) -> ast::view_item {
|
||||
self.view_use(sp, vis,
|
||||
~[@respan(sp,
|
||||
ast::view_path_glob(self.path(sp, path), self.next_id()))])
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ StaticEnum(<ast::enum_def of C>, ~[(<ident of C0>, Left(1)),
|
|||
*/
|
||||
|
||||
use ast;
|
||||
use ast::{enum_def, expr, ident, Generics, struct_def};
|
||||
use ast::{enum_def, expr, Ident, Generics, struct_def};
|
||||
|
||||
use ext::base::ExtCtxt;
|
||||
use ext::build::AstBuilder;
|
||||
|
|
@ -216,9 +216,9 @@ pub struct MethodDef<'self> {
|
|||
/// All the data about the data structure/method being derived upon.
|
||||
pub struct Substructure<'self> {
|
||||
/// ident of self
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
/// ident of the method
|
||||
method_ident: ident,
|
||||
method_ident: Ident,
|
||||
/// dereferenced access to any Self or Ptr(Self, _) arguments
|
||||
self_args: &'self [@expr],
|
||||
/// verbatim access to any other arguments
|
||||
|
|
@ -234,26 +234,26 @@ pub enum SubstructureFields<'self> {
|
|||
ident is the ident of the current field (`None` for all fields in tuple
|
||||
structs).
|
||||
*/
|
||||
Struct(~[(Option<ident>, @expr, ~[@expr])]),
|
||||
Struct(~[(Option<Ident>, @expr, ~[@expr])]),
|
||||
|
||||
/**
|
||||
Matching variants of the enum: variant index, ast::variant,
|
||||
fields: `(field ident, self, [others])`, where the field ident is
|
||||
only non-`None` in the case of a struct variant.
|
||||
*/
|
||||
EnumMatching(uint, &'self ast::variant, ~[(Option<ident>, @expr, ~[@expr])]),
|
||||
EnumMatching(uint, &'self ast::variant, ~[(Option<Ident>, @expr, ~[@expr])]),
|
||||
|
||||
/**
|
||||
non-matching variants of the enum, [(variant index, ast::variant,
|
||||
[field ident, fields])] (i.e. all fields for self are in the
|
||||
first tuple, for other1 are in the second tuple, etc.)
|
||||
*/
|
||||
EnumNonMatching(&'self [(uint, ast::variant, ~[(Option<ident>, @expr)])]),
|
||||
EnumNonMatching(&'self [(uint, ast::variant, ~[(Option<Ident>, @expr)])]),
|
||||
|
||||
/// A static method where Self is a struct
|
||||
StaticStruct(&'self ast::struct_def, Either<uint, ~[ident]>),
|
||||
StaticStruct(&'self ast::struct_def, Either<uint, ~[Ident]>),
|
||||
/// A static method where Self is an enum
|
||||
StaticEnum(&'self ast::enum_def, ~[(ident, Either<uint, ~[ident]>)])
|
||||
StaticEnum(&'self ast::enum_def, ~[(Ident, Either<uint, ~[Ident]>)])
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ representing each variant: (variant index, ast::variant instance,
|
|||
pub type EnumNonMatchFunc<'self> =
|
||||
&'self fn(@ExtCtxt, Span,
|
||||
&[(uint, ast::variant,
|
||||
~[(Option<ident>, @expr)])],
|
||||
~[(Option<Ident>, @expr)])],
|
||||
&[@expr]) -> @expr;
|
||||
|
||||
|
||||
|
|
@ -315,7 +315,7 @@ impl<'self> TraitDef<'self> {
|
|||
*
|
||||
*/
|
||||
fn create_derived_impl(&self, cx: @ExtCtxt, span: Span,
|
||||
type_ident: ident, generics: &Generics,
|
||||
type_ident: Ident, generics: &Generics,
|
||||
methods: ~[@ast::method]) -> @ast::item {
|
||||
let trait_path = self.path.to_path(cx, span, type_ident, generics);
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ impl<'self> TraitDef<'self> {
|
|||
fn expand_struct_def(&self, cx: @ExtCtxt,
|
||||
span: Span,
|
||||
struct_def: &struct_def,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
generics: &Generics) -> @ast::item {
|
||||
let methods = do self.methods.map |method_def| {
|
||||
let (explicit_self, self_args, nonself_args, tys) =
|
||||
|
|
@ -406,7 +406,7 @@ impl<'self> TraitDef<'self> {
|
|||
fn expand_enum_def(&self,
|
||||
cx: @ExtCtxt, span: Span,
|
||||
enum_def: &enum_def,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
generics: &Generics) -> @ast::item {
|
||||
let methods = do self.methods.map |method_def| {
|
||||
let (explicit_self, self_args, nonself_args, tys) =
|
||||
|
|
@ -439,7 +439,7 @@ impl<'self> MethodDef<'self> {
|
|||
fn call_substructure_method(&self,
|
||||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
self_args: &[@expr],
|
||||
nonself_args: &[@expr],
|
||||
fields: &SubstructureFields)
|
||||
|
|
@ -456,7 +456,7 @@ impl<'self> MethodDef<'self> {
|
|||
}
|
||||
|
||||
fn get_ret_ty(&self, cx: @ExtCtxt, span: Span,
|
||||
generics: &Generics, type_ident: ident) -> ast::Ty {
|
||||
generics: &Generics, type_ident: Ident) -> ast::Ty {
|
||||
self.ret_ty.to_ty(cx, span, type_ident, generics)
|
||||
}
|
||||
|
||||
|
|
@ -465,8 +465,8 @@ impl<'self> MethodDef<'self> {
|
|||
}
|
||||
|
||||
fn split_self_nonself_args(&self, cx: @ExtCtxt, span: Span,
|
||||
type_ident: ident, generics: &Generics)
|
||||
-> (ast::explicit_self, ~[@expr], ~[@expr], ~[(ident, ast::Ty)]) {
|
||||
type_ident: Ident, generics: &Generics)
|
||||
-> (ast::explicit_self, ~[@expr], ~[@expr], ~[(Ident, ast::Ty)]) {
|
||||
|
||||
let mut self_args = ~[];
|
||||
let mut nonself_args = ~[];
|
||||
|
|
@ -511,10 +511,10 @@ impl<'self> MethodDef<'self> {
|
|||
}
|
||||
|
||||
fn create_method(&self, cx: @ExtCtxt, span: Span,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
generics: &Generics,
|
||||
explicit_self: ast::explicit_self,
|
||||
arg_types: ~[(ident, ast::Ty)],
|
||||
arg_types: ~[(Ident, ast::Ty)],
|
||||
body: @expr) -> @ast::method {
|
||||
// create the generics that aren't for Self
|
||||
let fn_generics = self.generics.to_generics(cx, span, type_ident, generics);
|
||||
|
|
@ -571,7 +571,7 @@ impl<'self> MethodDef<'self> {
|
|||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
struct_def: &struct_def,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
self_args: &[@expr],
|
||||
nonself_args: &[@expr])
|
||||
-> @expr {
|
||||
|
|
@ -625,7 +625,7 @@ impl<'self> MethodDef<'self> {
|
|||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
struct_def: &struct_def,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
self_args: &[@expr],
|
||||
nonself_args: &[@expr])
|
||||
-> @expr {
|
||||
|
|
@ -667,7 +667,7 @@ impl<'self> MethodDef<'self> {
|
|||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
enum_def: &enum_def,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
self_args: &[@expr],
|
||||
nonself_args: &[@expr])
|
||||
-> @expr {
|
||||
|
|
@ -702,12 +702,12 @@ impl<'self> MethodDef<'self> {
|
|||
fn build_enum_match(&self,
|
||||
cx: @ExtCtxt, span: Span,
|
||||
enum_def: &enum_def,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
self_args: &[@expr],
|
||||
nonself_args: &[@expr],
|
||||
matching: Option<uint>,
|
||||
matches_so_far: &mut ~[(uint, ast::variant,
|
||||
~[(Option<ident>, @expr)])],
|
||||
~[(Option<Ident>, @expr)])],
|
||||
match_count: uint) -> @expr {
|
||||
if match_count == self_args.len() {
|
||||
// we've matched against all arguments, so make the final
|
||||
|
|
@ -852,7 +852,7 @@ impl<'self> MethodDef<'self> {
|
|||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
enum_def: &enum_def,
|
||||
type_ident: ident,
|
||||
type_ident: Ident,
|
||||
self_args: &[@expr],
|
||||
nonself_args: &[@expr])
|
||||
-> @expr {
|
||||
|
|
@ -874,7 +874,7 @@ impl<'self> MethodDef<'self> {
|
|||
}
|
||||
|
||||
fn summarise_struct(cx: @ExtCtxt, span: Span,
|
||||
struct_def: &struct_def) -> Either<uint, ~[ident]> {
|
||||
struct_def: &struct_def) -> Either<uint, ~[Ident]> {
|
||||
let mut named_idents = ~[];
|
||||
let mut unnamed_count = 0;
|
||||
for field in struct_def.fields.iter() {
|
||||
|
|
@ -913,11 +913,11 @@ enum StructType {
|
|||
|
||||
fn create_struct_pattern(cx: @ExtCtxt,
|
||||
span: Span,
|
||||
struct_ident: ident,
|
||||
struct_ident: Ident,
|
||||
struct_def: &struct_def,
|
||||
prefix: &str,
|
||||
mutbl: ast::mutability)
|
||||
-> (@ast::pat, ~[(Option<ident>, @expr)]) {
|
||||
-> (@ast::pat, ~[(Option<Ident>, @expr)]) {
|
||||
if struct_def.fields.is_empty() {
|
||||
return (
|
||||
cx.pat_ident_binding_mode(
|
||||
|
|
@ -977,7 +977,7 @@ fn create_enum_variant_pattern(cx: @ExtCtxt,
|
|||
variant: &ast::variant,
|
||||
prefix: &str,
|
||||
mutbl: ast::mutability)
|
||||
-> (@ast::pat, ~[(Option<ident>, @expr)]) {
|
||||
-> (@ast::pat, ~[(Option<Ident>, @expr)]) {
|
||||
|
||||
let variant_ident = variant.node.name;
|
||||
match variant.node.kind {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ library.
|
|||
|
||||
*/
|
||||
|
||||
use ast::{enum_def, ident, item, Generics, struct_def};
|
||||
use ast::{enum_def, Ident, item, Generics, struct_def};
|
||||
use ast::{MetaItem, MetaList, MetaNameValue, MetaWord};
|
||||
use ext::base::ExtCtxt;
|
||||
use ext::build::AstBuilder;
|
||||
|
|
@ -47,13 +47,13 @@ pub mod generic;
|
|||
pub type ExpandDerivingStructDefFn<'self> = &'self fn(@ExtCtxt,
|
||||
Span,
|
||||
x: &struct_def,
|
||||
ident,
|
||||
Ident,
|
||||
y: &Generics)
|
||||
-> @item;
|
||||
pub type ExpandDerivingEnumDefFn<'self> = &'self fn(@ExtCtxt,
|
||||
Span,
|
||||
x: &enum_def,
|
||||
ident,
|
||||
Ident,
|
||||
y: &Generics)
|
||||
-> @item;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
use ast;
|
||||
use ast::{MetaItem, item, expr, ident};
|
||||
use ast::{MetaItem, item, expr, Ident};
|
||||
use codemap::Span;
|
||||
use ext::base::ExtCtxt;
|
||||
use ext::build::{AstBuilder, Duplicate};
|
||||
|
|
@ -129,8 +129,8 @@ fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr {
|
|||
};
|
||||
|
||||
fn rand_thing(cx: @ExtCtxt, span: Span,
|
||||
ctor_ident: ident,
|
||||
summary: &Either<uint, ~[ident]>,
|
||||
ctor_ident: Ident,
|
||||
summary: &Either<uint, ~[Ident]>,
|
||||
rand_call: &fn() -> @expr) -> @expr {
|
||||
match *summary {
|
||||
Left(count) => {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ fn to_str_substructure(cx: @ExtCtxt, span: Span,
|
|||
substr: &Substructure) -> @expr {
|
||||
let to_str = cx.ident_of("to_str");
|
||||
|
||||
let doit = |start: &str, end: @str, name: ast::ident,
|
||||
fields: &[(Option<ast::ident>, @expr, ~[@expr])]| {
|
||||
let doit = |start: &str, end: @str, name: ast::Ident,
|
||||
fields: &[(Option<ast::Ident>, @expr, ~[@expr])]| {
|
||||
if fields.len() == 0 {
|
||||
cx.expr_str_uniq(span, cx.str_of(name))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ explicit `Self` type to use when specifying impls to be derived.
|
|||
*/
|
||||
|
||||
use ast;
|
||||
use ast::{expr,Generics,ident};
|
||||
use ast::{expr,Generics,Ident};
|
||||
use ext::base::ExtCtxt;
|
||||
use ext::build::AstBuilder;
|
||||
use codemap::{Span,respan};
|
||||
|
|
@ -59,7 +59,7 @@ impl<'self> Path<'self> {
|
|||
pub fn to_ty(&self,
|
||||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
self_ty: ident,
|
||||
self_ty: Ident,
|
||||
self_generics: &Generics)
|
||||
-> ast::Ty {
|
||||
cx.ty_path(self.to_path(cx, span, self_ty, self_generics), None)
|
||||
|
|
@ -67,7 +67,7 @@ impl<'self> Path<'self> {
|
|||
pub fn to_path(&self,
|
||||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
self_ty: ident,
|
||||
self_ty: Ident,
|
||||
self_generics: &Generics)
|
||||
-> ast::Path {
|
||||
let idents = self.path.map(|s| cx.ident_of(*s) );
|
||||
|
|
@ -120,7 +120,7 @@ impl<'self> Ty<'self> {
|
|||
pub fn to_ty(&self,
|
||||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
self_ty: ident,
|
||||
self_ty: Ident,
|
||||
self_generics: &Generics)
|
||||
-> ast::Ty {
|
||||
match *self {
|
||||
|
|
@ -158,7 +158,7 @@ impl<'self> Ty<'self> {
|
|||
pub fn to_path(&self,
|
||||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
self_ty: ident,
|
||||
self_ty: Ident,
|
||||
self_generics: &Generics)
|
||||
-> ast::Path {
|
||||
match *self {
|
||||
|
|
@ -186,7 +186,7 @@ impl<'self> Ty<'self> {
|
|||
|
||||
|
||||
fn mk_ty_param(cx: @ExtCtxt, span: Span, name: &str, bounds: &[Path],
|
||||
self_ident: ident, self_generics: &Generics) -> ast::TyParam {
|
||||
self_ident: Ident, self_generics: &Generics) -> ast::TyParam {
|
||||
let bounds = opt_vec::from(
|
||||
do bounds.map |b| {
|
||||
let path = b.to_path(cx, span, self_ident, self_generics);
|
||||
|
|
@ -217,7 +217,7 @@ impl<'self> LifetimeBounds<'self> {
|
|||
pub fn to_generics(&self,
|
||||
cx: @ExtCtxt,
|
||||
span: Span,
|
||||
self_ty: ident,
|
||||
self_ty: Ident,
|
||||
self_generics: &Generics)
|
||||
-> Generics {
|
||||
let lifetimes = do self.lifetimes.map |lt| {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use ast::{Block, Crate, NodeId, expr_, expr_mac, ident, mac_invoc_tt};
|
||||
use ast::{Block, Crate, NodeId, expr_, expr_mac, Ident, mac_invoc_tt};
|
||||
use ast::{item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi};
|
||||
use ast::{illegal_ctxt};
|
||||
use ast;
|
||||
|
|
@ -140,7 +140,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
|
|||
}
|
||||
}
|
||||
|
||||
fn mk_simple_path(ident: ast::ident, span: Span) -> ast::Path {
|
||||
fn mk_simple_path(ident: ast::Ident, span: Span) -> ast::Path {
|
||||
ast::Path {
|
||||
span: span,
|
||||
global: false,
|
||||
|
|
@ -523,7 +523,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
|
|||
|
||||
#[deriving(Clone)]
|
||||
struct NewNameFinderContext {
|
||||
ident_accumulator: @mut ~[ast::ident],
|
||||
ident_accumulator: @mut ~[ast::Ident],
|
||||
}
|
||||
|
||||
impl Visitor<()> for NewNameFinderContext {
|
||||
|
|
@ -645,7 +645,7 @@ impl Visitor<()> for NewNameFinderContext {
|
|||
|
||||
fn visit_struct_def(&mut self,
|
||||
struct_def: @ast::struct_def,
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
generics: &ast::Generics,
|
||||
node_id: NodeId,
|
||||
_: ()) {
|
||||
|
|
@ -667,7 +667,7 @@ impl Visitor<()> for NewNameFinderContext {
|
|||
// return a visitor that extracts the pat_ident paths
|
||||
// from a given pattern and puts them in a mutable
|
||||
// array (passed in to the traversal)
|
||||
pub fn new_name_finder(idents: @mut ~[ast::ident]) -> @mut Visitor<()> {
|
||||
pub fn new_name_finder(idents: @mut ~[ast::Ident]) -> @mut Visitor<()> {
|
||||
let context = @mut NewNameFinderContext {
|
||||
ident_accumulator: idents,
|
||||
};
|
||||
|
|
@ -697,7 +697,7 @@ fn get_block_info(exts : SyntaxEnv) -> BlockInfo {
|
|||
|
||||
// given a mutable list of renames, return a tree-folder that applies those
|
||||
// renames.
|
||||
fn renames_to_fold(renames : @mut ~[(ast::ident,ast::Name)]) -> @ast_fold {
|
||||
fn renames_to_fold(renames : @mut ~[(ast::Ident,ast::Name)]) -> @ast_fold {
|
||||
let afp = default_ast_fold();
|
||||
let f_pre = @AstFoldFns {
|
||||
fold_ident: |id,_| {
|
||||
|
|
@ -706,7 +706,7 @@ fn renames_to_fold(renames : @mut ~[(ast::ident,ast::Name)]) -> @ast_fold {
|
|||
let new_ctxt = renames.iter().fold(id.ctxt,|ctxt,&(from,to)| {
|
||||
new_rename(from,to,ctxt)
|
||||
});
|
||||
ast::ident{name:id.name,ctxt:new_ctxt}
|
||||
ast::Ident{name:id.name,ctxt:new_ctxt}
|
||||
},
|
||||
.. *afp
|
||||
};
|
||||
|
|
@ -1144,7 +1144,7 @@ pub fn expand_crate(parse_sess: @mut parse::ParseSess,
|
|||
|
||||
// given a function from idents to idents, produce
|
||||
// an ast_fold that applies that function:
|
||||
pub fn fun_to_ident_folder(f: @fn(ast::ident)->ast::ident) -> @ast_fold{
|
||||
pub fn fun_to_ident_folder(f: @fn(ast::Ident)->ast::Ident) -> @ast_fold{
|
||||
let afp = default_ast_fold();
|
||||
let f_pre = @AstFoldFns{
|
||||
fold_ident : |id, _| f(id),
|
||||
|
|
@ -1154,11 +1154,11 @@ pub fn fun_to_ident_folder(f: @fn(ast::ident)->ast::ident) -> @ast_fold{
|
|||
}
|
||||
|
||||
// update the ctxts in a path to get a rename node
|
||||
pub fn new_ident_renamer(from: ast::ident,
|
||||
pub fn new_ident_renamer(from: ast::Ident,
|
||||
to: ast::Name) ->
|
||||
@fn(ast::ident)->ast::ident {
|
||||
|id : ast::ident|
|
||||
ast::ident{
|
||||
@fn(ast::Ident)->ast::Ident {
|
||||
|id : ast::Ident|
|
||||
ast::Ident{
|
||||
name: id.name,
|
||||
ctxt: new_rename(from,to,id.ctxt)
|
||||
}
|
||||
|
|
@ -1167,9 +1167,9 @@ pub fn new_ident_renamer(from: ast::ident,
|
|||
|
||||
// update the ctxts in a path to get a mark node
|
||||
pub fn new_ident_marker(mark: uint) ->
|
||||
@fn(ast::ident)->ast::ident {
|
||||
|id : ast::ident|
|
||||
ast::ident{
|
||||
@fn(ast::Ident)->ast::Ident {
|
||||
|id : ast::Ident|
|
||||
ast::Ident{
|
||||
name: id.name,
|
||||
ctxt: new_mark(mark,id.ctxt)
|
||||
}
|
||||
|
|
@ -1178,9 +1178,9 @@ pub fn new_ident_marker(mark: uint) ->
|
|||
// perform resolution (in the MTWT sense) on all of the
|
||||
// idents in the tree. This is the final step in expansion.
|
||||
pub fn new_ident_resolver() ->
|
||||
@fn(ast::ident)->ast::ident {
|
||||
|id : ast::ident|
|
||||
ast::ident {
|
||||
@fn(ast::Ident)->ast::Ident {
|
||||
|id : ast::Ident|
|
||||
ast::Ident {
|
||||
name : resolve(id),
|
||||
ctxt : illegal_ctxt
|
||||
}
|
||||
|
|
@ -1304,7 +1304,7 @@ mod test {
|
|||
};
|
||||
let a_name = intern("a");
|
||||
let a2_name = intern("a2");
|
||||
let renamer = new_ident_renamer(ast::ident{name:a_name,ctxt:empty_ctxt},
|
||||
let renamer = new_ident_renamer(ast::Ident{name:a_name,ctxt:empty_ctxt},
|
||||
a2_name);
|
||||
let renamed_ast = fun_to_ident_folder(renamer).fold_item(item_ast).unwrap();
|
||||
let resolver = new_ident_resolver();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
|
|||
fn pieces_to_expr(cx: @ExtCtxt, sp: Span,
|
||||
pieces: ~[Piece], args: ~[@ast::expr])
|
||||
-> @ast::expr {
|
||||
fn make_path_vec(ident: &str) -> ~[ast::ident] {
|
||||
fn make_path_vec(ident: &str) -> ~[ast::Ident] {
|
||||
return ~[str_to_ident("std"),
|
||||
str_to_ident("unstable"),
|
||||
str_to_ident("extfmt"),
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ impl Context {
|
|||
}
|
||||
|
||||
fn format_arg(&self, sp: Span, arg: Either<uint, @str>,
|
||||
ident: ast::ident) -> @ast::expr {
|
||||
ident: ast::Ident) -> @ast::expr {
|
||||
let ty = match arg {
|
||||
Left(i) => self.arg_types[i].unwrap(),
|
||||
Right(s) => *self.name_types.get(&s)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ pub mod rt {
|
|||
fn to_source(&self) -> @str;
|
||||
}
|
||||
|
||||
impl ToSource for ast::ident {
|
||||
impl ToSource for ast::Ident {
|
||||
fn to_source(&self) -> @str {
|
||||
ident_to_str(self)
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ pub mod rt {
|
|||
)
|
||||
)
|
||||
|
||||
impl_to_tokens!(ast::ident)
|
||||
impl_to_tokens!(ast::Ident)
|
||||
impl_to_tokens!(@ast::item)
|
||||
impl_to_tokens_self!(&'self [@ast::item])
|
||||
impl_to_tokens!(ast::Ty)
|
||||
|
|
@ -334,16 +334,16 @@ pub fn expand_quote_stmt(cx: @ExtCtxt,
|
|||
~[e_attrs], tts))
|
||||
}
|
||||
|
||||
fn ids_ext(strs: ~[~str]) -> ~[ast::ident] {
|
||||
fn ids_ext(strs: ~[~str]) -> ~[ast::Ident] {
|
||||
strs.map(|str| str_to_ident(*str))
|
||||
}
|
||||
|
||||
fn id_ext(str: &str) -> ast::ident {
|
||||
fn id_ext(str: &str) -> ast::Ident {
|
||||
str_to_ident(str)
|
||||
}
|
||||
|
||||
// Lift an ident to the expr that evaluates to that ident.
|
||||
fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::ident) -> @ast::expr {
|
||||
fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::expr {
|
||||
let e_str = cx.expr_str(sp, cx.str_of(ident));
|
||||
cx.expr_method_call(sp,
|
||||
cx.expr_ident(sp, id_ext("ext_cx")),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// Earley-like parser for macros.
|
||||
|
||||
use ast;
|
||||
use ast::{matcher, match_tok, match_seq, match_nonterminal, ident};
|
||||
use ast::{matcher, match_tok, match_seq, match_nonterminal, Ident};
|
||||
use codemap::{BytePos, mk_sp};
|
||||
use codemap;
|
||||
use parse::lexer::*; //resolve bug?
|
||||
|
|
@ -189,9 +189,9 @@ pub enum named_match {
|
|||
pub type earley_item = ~MatcherPos;
|
||||
|
||||
pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match])
|
||||
-> HashMap<ident,@named_match> {
|
||||
-> HashMap<Ident,@named_match> {
|
||||
fn n_rec(p_s: @mut ParseSess, m: &matcher, res: &[@named_match],
|
||||
ret_val: &mut HashMap<ident, @named_match>) {
|
||||
ret_val: &mut HashMap<Ident, @named_match>) {
|
||||
match *m {
|
||||
codemap::Spanned {node: match_tok(_), _} => (),
|
||||
codemap::Spanned {node: match_seq(ref more_ms, _, _, _, _), _} => {
|
||||
|
|
@ -216,7 +216,7 @@ pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match])
|
|||
}
|
||||
|
||||
pub enum parse_result {
|
||||
success(HashMap<ident, @named_match>),
|
||||
success(HashMap<Ident, @named_match>),
|
||||
failure(codemap::Span, ~str),
|
||||
error(codemap::Span, ~str)
|
||||
}
|
||||
|
|
@ -226,7 +226,7 @@ pub fn parse_or_else(
|
|||
cfg: ast::CrateConfig,
|
||||
rdr: @mut reader,
|
||||
ms: ~[matcher]
|
||||
) -> HashMap<ident, @named_match> {
|
||||
) -> HashMap<Ident, @named_match> {
|
||||
match parse(sess, cfg, rdr, ms) {
|
||||
success(m) => m,
|
||||
failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq};
|
||||
use ast::{Ident, matcher_, matcher, match_tok, match_nonterminal, match_seq};
|
||||
use ast::{tt_delim};
|
||||
use ast;
|
||||
use codemap::{Span, Spanned, dummy_sp};
|
||||
|
|
@ -25,7 +25,7 @@ use print;
|
|||
|
||||
pub fn add_new_extension(cx: @ExtCtxt,
|
||||
sp: Span,
|
||||
name: ident,
|
||||
name: Ident,
|
||||
arg: ~[ast::token_tree])
|
||||
-> base::MacResult {
|
||||
// these spans won't matter, anyways
|
||||
|
|
@ -74,7 +74,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
|
|||
};
|
||||
|
||||
// Given `lhses` and `rhses`, this is the new macro we create
|
||||
fn generic_extension(cx: @ExtCtxt, sp: Span, name: ident,
|
||||
fn generic_extension(cx: @ExtCtxt, sp: Span, name: Ident,
|
||||
arg: &[ast::token_tree],
|
||||
lhses: &[@named_match], rhses: &[@named_match])
|
||||
-> MacResult {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
use ast;
|
||||
use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident};
|
||||
use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,Ident};
|
||||
use codemap::{Span, dummy_sp};
|
||||
use diagnostic::span_handler;
|
||||
use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal};
|
||||
|
|
@ -34,7 +34,7 @@ pub struct TtReader {
|
|||
// the unzipped tree:
|
||||
stack: @mut TtFrame,
|
||||
/* for MBE-style macro transcription */
|
||||
interpolations: HashMap<ident, @named_match>,
|
||||
interpolations: HashMap<Ident, @named_match>,
|
||||
repeat_idx: ~[uint],
|
||||
repeat_len: ~[uint],
|
||||
/* cached: */
|
||||
|
|
@ -46,7 +46,7 @@ pub struct TtReader {
|
|||
* `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and
|
||||
* should) be none. */
|
||||
pub fn new_tt_reader(sp_diag: @mut span_handler,
|
||||
interp: Option<HashMap<ident,@named_match>>,
|
||||
interp: Option<HashMap<Ident,@named_match>>,
|
||||
src: ~[ast::token_tree])
|
||||
-> @mut TtReader {
|
||||
let r = @mut TtReader {
|
||||
|
|
@ -113,7 +113,7 @@ fn lookup_cur_matched_by_matched(r: &mut TtReader,
|
|||
r.repeat_idx.iter().fold(start, red)
|
||||
}
|
||||
|
||||
fn lookup_cur_matched(r: &mut TtReader, name: ident) -> @named_match {
|
||||
fn lookup_cur_matched(r: &mut TtReader, name: Ident) -> @named_match {
|
||||
match r.interpolations.find_copy(&name) {
|
||||
Some(s) => lookup_cur_matched_by_matched(r, s),
|
||||
None => {
|
||||
|
|
@ -126,7 +126,7 @@ fn lookup_cur_matched(r: &mut TtReader, name: ident) -> @named_match {
|
|||
#[deriving(Clone)]
|
||||
enum lis {
|
||||
lis_unconstrained,
|
||||
lis_constraint(uint, ident),
|
||||
lis_constraint(uint, Ident),
|
||||
lis_contradiction(~str),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ pub trait ast_fold {
|
|||
fn fold_mod(@self, &_mod) -> _mod;
|
||||
fn fold_foreign_mod(@self, &foreign_mod) -> foreign_mod;
|
||||
fn fold_variant(@self, &variant) -> variant;
|
||||
fn fold_ident(@self, ident) -> ident;
|
||||
fn fold_ident(@self, Ident) -> Ident;
|
||||
fn fold_path(@self, &Path) -> Path;
|
||||
fn fold_local(@self, @Local) -> @Local;
|
||||
fn map_exprs(@self, @fn(@expr) -> @expr, &[@expr]) -> ~[@expr];
|
||||
|
|
@ -61,7 +61,7 @@ pub struct AstFoldFns {
|
|||
fold_mod: @fn(&_mod, @ast_fold) -> _mod,
|
||||
fold_foreign_mod: @fn(&foreign_mod, @ast_fold) -> foreign_mod,
|
||||
fold_variant: @fn(&variant_, Span, @ast_fold) -> (variant_, Span),
|
||||
fold_ident: @fn(ident, @ast_fold) -> ident,
|
||||
fold_ident: @fn(Ident, @ast_fold) -> Ident,
|
||||
fold_path: @fn(&Path, @ast_fold) -> Path,
|
||||
fold_local: @fn(@Local, @ast_fold) -> @Local,
|
||||
map_exprs: @fn(@fn(@expr) -> @expr, &[@expr]) -> ~[@expr],
|
||||
|
|
@ -758,7 +758,7 @@ fn noop_fold_variant(v: &variant_, fld: @ast_fold) -> variant_ {
|
|||
}
|
||||
}
|
||||
|
||||
fn noop_fold_ident(i: ident, _fld: @ast_fold) -> ident {
|
||||
fn noop_fold_ident(i: Ident, _fld: @ast_fold) -> Ident {
|
||||
i
|
||||
}
|
||||
|
||||
|
|
@ -913,7 +913,7 @@ impl ast_fold for AstFoldFns {
|
|||
let (n, s) = (self.fold_variant)(&x.node, x.span, self as @ast_fold);
|
||||
Spanned { node: n, span: (self.new_span)(s) }
|
||||
}
|
||||
fn fold_ident(@self, x: ident) -> ident {
|
||||
fn fold_ident(@self, x: Ident) -> Ident {
|
||||
(self.fold_ident)(x, self as @ast_fold)
|
||||
}
|
||||
fn fold_path(@self, x: &Path) -> Path {
|
||||
|
|
@ -961,7 +961,7 @@ mod test {
|
|||
// taken from expand
|
||||
// given a function from idents to idents, produce
|
||||
// an ast_fold that applies that function:
|
||||
pub fn fun_to_ident_folder(f: @fn(ast::ident)->ast::ident) -> @ast_fold{
|
||||
pub fn fun_to_ident_folder(f: @fn(ast::Ident)->ast::Ident) -> @ast_fold{
|
||||
let afp = default_ast_fold();
|
||||
let f_pre = @AstFoldFns{
|
||||
fold_ident : |id, _| f(id),
|
||||
|
|
@ -976,7 +976,7 @@ mod test {
|
|||
}
|
||||
|
||||
// change every identifier to "zz"
|
||||
pub fn to_zz() -> @fn(ast::ident)->ast::ident {
|
||||
pub fn to_zz() -> @fn(ast::Ident)->ast::Ident {
|
||||
let zz_id = token::str_to_ident("zz");
|
||||
|_id| {zz_id}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ pub enum vt<E> { mk_vt(visitor<E>), }
|
|||
|
||||
pub enum fn_kind<'self> {
|
||||
// fn foo() or extern "Abi" fn foo()
|
||||
fk_item_fn(ident, &'self Generics, purity, AbiSet),
|
||||
fk_item_fn(Ident, &'self Generics, purity, AbiSet),
|
||||
|
||||
// fn foo(&self)
|
||||
fk_method(ident, &'self Generics, &'self method),
|
||||
fk_method(Ident, &'self Generics, &'self method),
|
||||
|
||||
// @fn(x, y) { ... }
|
||||
fk_anon(ast::Sigil),
|
||||
|
|
@ -46,7 +46,7 @@ pub enum fn_kind<'self> {
|
|||
fk_fn_block,
|
||||
}
|
||||
|
||||
pub fn name_of_fn(fk: &fn_kind) -> ident {
|
||||
pub fn name_of_fn(fk: &fn_kind) -> Ident {
|
||||
match *fk {
|
||||
fk_item_fn(name, _, _, _) | fk_method(name, _, _) => {
|
||||
name
|
||||
|
|
@ -88,7 +88,7 @@ pub struct Visitor<E> {
|
|||
visit_fn: @fn(&fn_kind, &fn_decl, &Block, Span, NodeId, (E, vt<E>)),
|
||||
visit_ty_method: @fn(&TypeMethod, (E, vt<E>)),
|
||||
visit_trait_method: @fn(&trait_method, (E, vt<E>)),
|
||||
visit_struct_def: @fn(@struct_def, ident, &Generics, NodeId, (E, vt<E>)),
|
||||
visit_struct_def: @fn(@struct_def, Ident, &Generics, NodeId, (E, vt<E>)),
|
||||
visit_struct_field: @fn(@struct_field, (E, vt<E>)),
|
||||
}
|
||||
|
||||
|
|
@ -422,7 +422,7 @@ pub fn visit_trait_method<E:Clone>(m: &trait_method, (e, v): (E, vt<E>)) {
|
|||
|
||||
pub fn visit_struct_def<E:Clone>(
|
||||
sd: @struct_def,
|
||||
_nm: ast::ident,
|
||||
_nm: ast::Ident,
|
||||
_generics: &Generics,
|
||||
_id: NodeId,
|
||||
(e, v): (E, vt<E>)
|
||||
|
|
@ -612,7 +612,7 @@ pub struct SimpleVisitor {
|
|||
visit_fn: @fn(&fn_kind, &fn_decl, &Block, Span, NodeId),
|
||||
visit_ty_method: @fn(&TypeMethod),
|
||||
visit_trait_method: @fn(&trait_method),
|
||||
visit_struct_def: @fn(@struct_def, ident, &Generics, NodeId),
|
||||
visit_struct_def: @fn(@struct_def, Ident, &Generics, NodeId),
|
||||
visit_struct_field: @fn(@struct_field),
|
||||
visit_struct_method: @fn(@method)
|
||||
}
|
||||
|
|
@ -715,9 +715,9 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
|
|||
visit_trait_method(m, (e, v));
|
||||
}
|
||||
fn v_struct_def(
|
||||
f: @fn(@struct_def, ident, &Generics, NodeId),
|
||||
f: @fn(@struct_def, Ident, &Generics, NodeId),
|
||||
sd: @struct_def,
|
||||
nm: ident,
|
||||
nm: Ident,
|
||||
generics: &Generics,
|
||||
id: NodeId,
|
||||
(e, v): ((), vt<()>)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ use ast::{expr_vstore_slice, expr_vstore_box};
|
|||
use ast::{expr_vstore_mut_slice, expr_while, expr_for_loop, extern_fn, Field, fn_decl};
|
||||
use ast::{expr_vstore_uniq, Onceness, Once, Many};
|
||||
use ast::{foreign_item, foreign_item_static, foreign_item_fn, foreign_mod};
|
||||
use ast::{ident, impure_fn, inherited, item, item_, item_static};
|
||||
use ast::{Ident, impure_fn, inherited, item, item_, item_static};
|
||||
use ast::{item_enum, item_fn, item_foreign_mod, item_impl};
|
||||
use ast::{item_mac, item_mod, item_struct, item_trait, item_ty, lit, lit_};
|
||||
use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int};
|
||||
|
|
@ -95,7 +95,7 @@ enum restriction {
|
|||
}
|
||||
|
||||
type arg_or_capture_item = Either<arg, ()>;
|
||||
type item_info = (ident, item_, Option<~[Attribute]>);
|
||||
type item_info = (Ident, item_, Option<~[Attribute]>);
|
||||
|
||||
/// How to parse a path. There are four different kinds of paths, all of which
|
||||
/// are parsed somewhat differently.
|
||||
|
|
@ -476,7 +476,7 @@ impl Parser {
|
|||
self.commit_stmt(s, &[edible], &[])
|
||||
}
|
||||
|
||||
pub fn parse_ident(&self) -> ast::ident {
|
||||
pub fn parse_ident(&self) -> ast::Ident {
|
||||
self.check_strict_keywords();
|
||||
self.check_reserved_keywords();
|
||||
match *self.token {
|
||||
|
|
@ -756,7 +756,7 @@ impl Parser {
|
|||
}
|
||||
pub fn get_id(&self) -> NodeId { next_node_id(self.sess) }
|
||||
|
||||
pub fn id_to_str(&self, id: ident) -> @str {
|
||||
pub fn id_to_str(&self, id: Ident) -> @str {
|
||||
get_ident_interner().get(id.name)
|
||||
}
|
||||
|
||||
|
|
@ -775,7 +775,7 @@ impl Parser {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_lifetime(&self, tok: &token::Token) -> ast::ident {
|
||||
pub fn get_lifetime(&self, tok: &token::Token) -> ast::Ident {
|
||||
match *tok {
|
||||
token::LIFETIME(ref ident) => *ident,
|
||||
_ => self.bug("not a lifetime"),
|
||||
|
|
@ -1664,7 +1664,7 @@ impl Parser {
|
|||
|
||||
pub fn mk_method_call(&self,
|
||||
rcvr: @expr,
|
||||
ident: ident,
|
||||
ident: Ident,
|
||||
tps: ~[Ty],
|
||||
args: ~[@expr],
|
||||
sugar: CallSugar) -> ast::expr_ {
|
||||
|
|
@ -1675,7 +1675,7 @@ impl Parser {
|
|||
expr_index(self.get_id(), expr, idx)
|
||||
}
|
||||
|
||||
pub fn mk_field(&self, expr: @expr, ident: ident, tys: ~[Ty]) -> ast::expr_ {
|
||||
pub fn mk_field(&self, expr: @expr, ident: Ident, tys: ~[Ty]) -> ast::expr_ {
|
||||
expr_field(expr, ident, tys)
|
||||
}
|
||||
|
||||
|
|
@ -2550,7 +2550,7 @@ impl Parser {
|
|||
return self.mk_expr(lo, hi, expr_while(cond, body));
|
||||
}
|
||||
|
||||
pub fn parse_loop_expr(&self, opt_ident: Option<ast::ident>) -> @expr {
|
||||
pub fn parse_loop_expr(&self, opt_ident: Option<ast::Ident>) -> @expr {
|
||||
// loop headers look like 'loop {' or 'loop unsafe {'
|
||||
let is_loop_header =
|
||||
*self.token == token::LBRACE
|
||||
|
|
@ -3713,13 +3713,13 @@ impl Parser {
|
|||
}
|
||||
|
||||
// parse the name and optional generic types of a function header.
|
||||
fn parse_fn_header(&self) -> (ident, ast::Generics) {
|
||||
fn parse_fn_header(&self) -> (Ident, ast::Generics) {
|
||||
let id = self.parse_ident();
|
||||
let generics = self.parse_generics();
|
||||
(id, generics)
|
||||
}
|
||||
|
||||
fn mk_item(&self, lo: BytePos, hi: BytePos, ident: ident,
|
||||
fn mk_item(&self, lo: BytePos, hi: BytePos, ident: Ident,
|
||||
node: item_, vis: visibility,
|
||||
attrs: ~[Attribute]) -> @item {
|
||||
@ast::item { ident: ident,
|
||||
|
|
@ -4107,7 +4107,7 @@ impl Parser {
|
|||
}
|
||||
}
|
||||
|
||||
fn push_mod_path(&self, id: ident, attrs: &[Attribute]) {
|
||||
fn push_mod_path(&self, id: Ident, attrs: &[Attribute]) {
|
||||
let default_path = token::interner_get(id.name);
|
||||
let file_path = match ::attr::first_attr_value_str_by_name(attrs,
|
||||
"path") {
|
||||
|
|
@ -4123,7 +4123,7 @@ impl Parser {
|
|||
|
||||
// read a module from a source file.
|
||||
fn eval_src_mod(&self,
|
||||
id: ast::ident,
|
||||
id: ast::Ident,
|
||||
outer_attrs: &[ast::Attribute],
|
||||
id_sp: Span)
|
||||
-> (ast::item_, ~[ast::Attribute]) {
|
||||
|
|
|
|||
|
|
@ -76,22 +76,22 @@ pub enum Token {
|
|||
LIT_INT(i64, ast::int_ty),
|
||||
LIT_UINT(u64, ast::uint_ty),
|
||||
LIT_INT_UNSUFFIXED(i64),
|
||||
LIT_FLOAT(ast::ident, ast::float_ty),
|
||||
LIT_FLOAT_UNSUFFIXED(ast::ident),
|
||||
LIT_STR(ast::ident),
|
||||
LIT_FLOAT(ast::Ident, ast::float_ty),
|
||||
LIT_FLOAT_UNSUFFIXED(ast::Ident),
|
||||
LIT_STR(ast::Ident),
|
||||
|
||||
/* Name components */
|
||||
// an identifier contains an "is_mod_name" boolean,
|
||||
// indicating whether :: follows this token with no
|
||||
// whitespace in between.
|
||||
IDENT(ast::ident, bool),
|
||||
IDENT(ast::Ident, bool),
|
||||
UNDERSCORE,
|
||||
LIFETIME(ast::ident),
|
||||
LIFETIME(ast::Ident),
|
||||
|
||||
/* For interpolation */
|
||||
INTERPOLATED(nonterminal),
|
||||
|
||||
DOC_COMMENT(ast::ident),
|
||||
DOC_COMMENT(ast::Ident),
|
||||
EOF,
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ pub enum nonterminal {
|
|||
nt_pat( @ast::pat),
|
||||
nt_expr(@ast::expr),
|
||||
nt_ty( ~ast::Ty),
|
||||
nt_ident(~ast::ident, bool),
|
||||
nt_ident(~ast::Ident, bool),
|
||||
nt_attr(@ast::Attribute), // #[foo]
|
||||
nt_path(~ast::Path),
|
||||
nt_tt( @ast::token_tree), //needs @ed to break a circularity
|
||||
|
|
@ -307,46 +307,46 @@ pub fn is_bar(t: &Token) -> bool {
|
|||
|
||||
|
||||
pub mod special_idents {
|
||||
use ast::ident;
|
||||
use ast::Ident;
|
||||
|
||||
pub static underscore : ident = ident { name: 0, ctxt: 0};
|
||||
pub static anon : ident = ident { name: 1, ctxt: 0};
|
||||
pub static invalid : ident = ident { name: 2, ctxt: 0}; // ''
|
||||
pub static unary : ident = ident { name: 3, ctxt: 0};
|
||||
pub static not_fn : ident = ident { name: 4, ctxt: 0};
|
||||
pub static idx_fn : ident = ident { name: 5, ctxt: 0};
|
||||
pub static unary_minus_fn : ident = ident { name: 6, ctxt: 0};
|
||||
pub static clownshoes_extensions : ident = ident { name: 7, ctxt: 0};
|
||||
pub static underscore : Ident = Ident { name: 0, ctxt: 0};
|
||||
pub static anon : Ident = Ident { name: 1, ctxt: 0};
|
||||
pub static invalid : Ident = Ident { name: 2, ctxt: 0}; // ''
|
||||
pub static unary : Ident = Ident { name: 3, ctxt: 0};
|
||||
pub static not_fn : Ident = Ident { name: 4, ctxt: 0};
|
||||
pub static idx_fn : Ident = Ident { name: 5, ctxt: 0};
|
||||
pub static unary_minus_fn : Ident = Ident { name: 6, ctxt: 0};
|
||||
pub static clownshoes_extensions : Ident = Ident { name: 7, ctxt: 0};
|
||||
|
||||
pub static self_ : ident = ident { name: 8, ctxt: 0}; // 'self'
|
||||
pub static self_ : Ident = Ident { name: 8, ctxt: 0}; // 'self'
|
||||
|
||||
/* for matcher NTs */
|
||||
pub static item : ident = ident { name: 9, ctxt: 0};
|
||||
pub static block : ident = ident { name: 10, ctxt: 0};
|
||||
pub static stmt : ident = ident { name: 11, ctxt: 0};
|
||||
pub static pat : ident = ident { name: 12, ctxt: 0};
|
||||
pub static expr : ident = ident { name: 13, ctxt: 0};
|
||||
pub static ty : ident = ident { name: 14, ctxt: 0};
|
||||
pub static ident : ident = ident { name: 15, ctxt: 0};
|
||||
pub static path : ident = ident { name: 16, ctxt: 0};
|
||||
pub static tt : ident = ident { name: 17, ctxt: 0};
|
||||
pub static matchers : ident = ident { name: 18, ctxt: 0};
|
||||
pub static item : Ident = Ident { name: 9, ctxt: 0};
|
||||
pub static block : Ident = Ident { name: 10, ctxt: 0};
|
||||
pub static stmt : Ident = Ident { name: 11, ctxt: 0};
|
||||
pub static pat : Ident = Ident { name: 12, ctxt: 0};
|
||||
pub static expr : Ident = Ident { name: 13, ctxt: 0};
|
||||
pub static ty : Ident = Ident { name: 14, ctxt: 0};
|
||||
pub static ident : Ident = Ident { name: 15, ctxt: 0};
|
||||
pub static path : Ident = Ident { name: 16, ctxt: 0};
|
||||
pub static tt : Ident = Ident { name: 17, ctxt: 0};
|
||||
pub static matchers : Ident = Ident { name: 18, ctxt: 0};
|
||||
|
||||
pub static str : ident = ident { name: 19, ctxt: 0}; // for the type
|
||||
pub static str : Ident = Ident { name: 19, ctxt: 0}; // for the type
|
||||
|
||||
/* outside of libsyntax */
|
||||
pub static arg : ident = ident { name: 20, ctxt: 0};
|
||||
pub static descrim : ident = ident { name: 21, ctxt: 0};
|
||||
pub static clownshoe_abi : ident = ident { name: 22, ctxt: 0};
|
||||
pub static clownshoe_stack_shim : ident = ident { name: 23, ctxt: 0};
|
||||
pub static main : ident = ident { name: 24, ctxt: 0};
|
||||
pub static opaque : ident = ident { name: 25, ctxt: 0};
|
||||
pub static blk : ident = ident { name: 26, ctxt: 0};
|
||||
pub static statik : ident = ident { name: 27, ctxt: 0};
|
||||
pub static clownshoes_foreign_mod: ident = ident { name: 28, ctxt: 0};
|
||||
pub static unnamed_field: ident = ident { name: 29, ctxt: 0};
|
||||
pub static c_abi: ident = ident { name: 30, ctxt: 0};
|
||||
pub static type_self: ident = ident { name: 31, ctxt: 0}; // `Self`
|
||||
pub static arg : Ident = Ident { name: 20, ctxt: 0};
|
||||
pub static descrim : Ident = Ident { name: 21, ctxt: 0};
|
||||
pub static clownshoe_abi : Ident = Ident { name: 22, ctxt: 0};
|
||||
pub static clownshoe_stack_shim : Ident = Ident { name: 23, ctxt: 0};
|
||||
pub static main : Ident = Ident { name: 24, ctxt: 0};
|
||||
pub static opaque : Ident = Ident { name: 25, ctxt: 0};
|
||||
pub static blk : Ident = Ident { name: 26, ctxt: 0};
|
||||
pub static statik : Ident = Ident { name: 27, ctxt: 0};
|
||||
pub static clownshoes_foreign_mod: Ident = Ident { name: 28, ctxt: 0};
|
||||
pub static unnamed_field: Ident = Ident { name: 29, ctxt: 0};
|
||||
pub static c_abi: Ident = Ident { name: 30, ctxt: 0};
|
||||
pub static type_self: Ident = Ident { name: 31, ctxt: 0}; // `Self`
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -525,18 +525,18 @@ pub fn interner_get(name : Name) -> @str {
|
|||
}
|
||||
|
||||
// maps an identifier to the string that it corresponds to
|
||||
pub fn ident_to_str(id : &ast::ident) -> @str {
|
||||
pub fn ident_to_str(id : &ast::Ident) -> @str {
|
||||
interner_get(id.name)
|
||||
}
|
||||
|
||||
// maps a string to an identifier with an empty syntax context
|
||||
pub fn str_to_ident(str : &str) -> ast::ident {
|
||||
ast::new_ident(intern(str))
|
||||
pub fn str_to_ident(str : &str) -> ast::Ident {
|
||||
ast::Ident::new(intern(str))
|
||||
}
|
||||
|
||||
// maps a string to a gensym'ed identifier
|
||||
pub fn gensym_ident(str : &str) -> ast::ident {
|
||||
ast::new_ident(gensym(str))
|
||||
pub fn gensym_ident(str : &str) -> ast::Ident {
|
||||
ast::Ident::new(gensym(str))
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -561,7 +561,7 @@ pub fn fresh_name(src_name : &str) -> Name {
|
|||
* the language and may not appear as identifiers.
|
||||
*/
|
||||
pub mod keywords {
|
||||
use ast::ident;
|
||||
use ast::Ident;
|
||||
|
||||
pub enum Keyword {
|
||||
// Strict keywords
|
||||
|
|
@ -608,46 +608,46 @@ pub mod keywords {
|
|||
}
|
||||
|
||||
impl Keyword {
|
||||
pub fn to_ident(&self) -> ident {
|
||||
pub fn to_ident(&self) -> Ident {
|
||||
match *self {
|
||||
As => ident { name: 32, ctxt: 0 },
|
||||
Break => ident { name: 33, ctxt: 0 },
|
||||
Const => ident { name: 34, ctxt: 0 },
|
||||
Do => ident { name: 35, ctxt: 0 },
|
||||
Else => ident { name: 36, ctxt: 0 },
|
||||
Enum => ident { name: 37, ctxt: 0 },
|
||||
Extern => ident { name: 38, ctxt: 0 },
|
||||
False => ident { name: 39, ctxt: 0 },
|
||||
Fn => ident { name: 40, ctxt: 0 },
|
||||
For => ident { name: 41, ctxt: 0 },
|
||||
If => ident { name: 42, ctxt: 0 },
|
||||
Impl => ident { name: 43, ctxt: 0 },
|
||||
In => ident { name: 63, ctxt: 0 },
|
||||
Let => ident { name: 44, ctxt: 0 },
|
||||
__Log => ident { name: 45, ctxt: 0 },
|
||||
Loop => ident { name: 46, ctxt: 0 },
|
||||
Match => ident { name: 47, ctxt: 0 },
|
||||
Mod => ident { name: 48, ctxt: 0 },
|
||||
Mut => ident { name: 49, ctxt: 0 },
|
||||
Once => ident { name: 50, ctxt: 0 },
|
||||
Priv => ident { name: 51, ctxt: 0 },
|
||||
Pub => ident { name: 52, ctxt: 0 },
|
||||
Ref => ident { name: 53, ctxt: 0 },
|
||||
Return => ident { name: 54, ctxt: 0 },
|
||||
Static => ident { name: 27, ctxt: 0 },
|
||||
Self => ident { name: 8, ctxt: 0 },
|
||||
Struct => ident { name: 55, ctxt: 0 },
|
||||
Super => ident { name: 56, ctxt: 0 },
|
||||
True => ident { name: 57, ctxt: 0 },
|
||||
Trait => ident { name: 58, ctxt: 0 },
|
||||
Type => ident { name: 59, ctxt: 0 },
|
||||
Typeof => ident { name: 67, ctxt: 0 },
|
||||
Unsafe => ident { name: 60, ctxt: 0 },
|
||||
Use => ident { name: 61, ctxt: 0 },
|
||||
While => ident { name: 62, ctxt: 0 },
|
||||
Be => ident { name: 64, ctxt: 0 },
|
||||
Pure => ident { name: 65, ctxt: 0 },
|
||||
Yield => ident { name: 66, ctxt: 0 },
|
||||
As => Ident { name: 32, ctxt: 0 },
|
||||
Break => Ident { name: 33, ctxt: 0 },
|
||||
Const => Ident { name: 34, ctxt: 0 },
|
||||
Do => Ident { name: 35, ctxt: 0 },
|
||||
Else => Ident { name: 36, ctxt: 0 },
|
||||
Enum => Ident { name: 37, ctxt: 0 },
|
||||
Extern => Ident { name: 38, ctxt: 0 },
|
||||
False => Ident { name: 39, ctxt: 0 },
|
||||
Fn => Ident { name: 40, ctxt: 0 },
|
||||
For => Ident { name: 41, ctxt: 0 },
|
||||
If => Ident { name: 42, ctxt: 0 },
|
||||
Impl => Ident { name: 43, ctxt: 0 },
|
||||
In => Ident { name: 63, ctxt: 0 },
|
||||
Let => Ident { name: 44, ctxt: 0 },
|
||||
__Log => Ident { name: 45, ctxt: 0 },
|
||||
Loop => Ident { name: 46, ctxt: 0 },
|
||||
Match => Ident { name: 47, ctxt: 0 },
|
||||
Mod => Ident { name: 48, ctxt: 0 },
|
||||
Mut => Ident { name: 49, ctxt: 0 },
|
||||
Once => Ident { name: 50, ctxt: 0 },
|
||||
Priv => Ident { name: 51, ctxt: 0 },
|
||||
Pub => Ident { name: 52, ctxt: 0 },
|
||||
Ref => Ident { name: 53, ctxt: 0 },
|
||||
Return => Ident { name: 54, ctxt: 0 },
|
||||
Static => Ident { name: 27, ctxt: 0 },
|
||||
Self => Ident { name: 8, ctxt: 0 },
|
||||
Struct => Ident { name: 55, ctxt: 0 },
|
||||
Super => Ident { name: 56, ctxt: 0 },
|
||||
True => Ident { name: 57, ctxt: 0 },
|
||||
Trait => Ident { name: 58, ctxt: 0 },
|
||||
Type => Ident { name: 59, ctxt: 0 },
|
||||
Typeof => Ident { name: 67, ctxt: 0 },
|
||||
Unsafe => Ident { name: 60, ctxt: 0 },
|
||||
Use => Ident { name: 61, ctxt: 0 },
|
||||
While => Ident { name: 62, ctxt: 0 },
|
||||
Be => Ident { name: 64, ctxt: 0 },
|
||||
Pure => Ident { name: 65, ctxt: 0 },
|
||||
Yield => Ident { name: 66, ctxt: 0 },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ pub fn path_to_str(p: &ast::Path, intr: @ident_interner) -> ~str {
|
|||
to_str(p, |a,b| print_path(a, b, false), intr)
|
||||
}
|
||||
|
||||
pub fn fun_to_str(decl: &ast::fn_decl, purity: ast::purity, name: ast::ident,
|
||||
pub fn fun_to_str(decl: &ast::fn_decl, purity: ast::purity, name: ast::Ident,
|
||||
opt_explicit_self: Option<ast::explicit_self_>,
|
||||
generics: &ast::Generics, intr: @ident_interner) -> ~str {
|
||||
do io::with_str_writer |wr| {
|
||||
|
|
@ -639,7 +639,7 @@ fn print_trait_ref(s: @ps, t: &ast::trait_ref) {
|
|||
}
|
||||
|
||||
pub fn print_enum_def(s: @ps, enum_definition: &ast::enum_def,
|
||||
generics: &ast::Generics, ident: ast::ident,
|
||||
generics: &ast::Generics, ident: ast::Ident,
|
||||
span: codemap::Span, visibility: ast::visibility) {
|
||||
head(s, visibility_qualified(visibility, "enum"));
|
||||
print_ident(s, ident);
|
||||
|
|
@ -691,7 +691,7 @@ pub fn print_visibility(s: @ps, vis: ast::visibility) {
|
|||
pub fn print_struct(s: @ps,
|
||||
struct_def: &ast::struct_def,
|
||||
generics: &ast::Generics,
|
||||
ident: ast::ident,
|
||||
ident: ast::Ident,
|
||||
span: codemap::Span) {
|
||||
print_ident(s, ident);
|
||||
print_generics(s, generics);
|
||||
|
|
@ -1495,7 +1495,7 @@ pub fn print_decl(s: @ps, decl: &ast::decl) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn print_ident(s: @ps, ident: ast::ident) {
|
||||
pub fn print_ident(s: @ps, ident: ast::Ident) {
|
||||
word(s.s, ident_to_str(&ident));
|
||||
}
|
||||
|
||||
|
|
@ -1698,7 +1698,7 @@ pub fn print_fn(s: @ps,
|
|||
decl: &ast::fn_decl,
|
||||
purity: Option<ast::purity>,
|
||||
abis: AbiSet,
|
||||
name: ast::ident,
|
||||
name: ast::Ident,
|
||||
generics: &ast::Generics,
|
||||
opt_explicit_self: Option<ast::explicit_self_>,
|
||||
vis: ast::visibility) {
|
||||
|
|
@ -1946,7 +1946,7 @@ pub fn print_ty_fn(s: @ps,
|
|||
purity: ast::purity,
|
||||
onceness: ast::Onceness,
|
||||
decl: &ast::fn_decl,
|
||||
id: Option<ast::ident>,
|
||||
id: Option<ast::Ident>,
|
||||
opt_bounds: &Option<OptVec<ast::TyParamBound>>,
|
||||
generics: Option<&ast::Generics>,
|
||||
opt_explicit_self: Option<ast::explicit_self_>) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ pub fn string_to_pat(source_str : @str) -> @ast::pat {
|
|||
}
|
||||
|
||||
// convert a vector of strings to a vector of ast::idents
|
||||
pub fn strs_to_idents(ids: ~[&str]) -> ~[ast::ident] {
|
||||
pub fn strs_to_idents(ids: ~[&str]) -> ~[ast::Ident] {
|
||||
ids.map(|u| token::str_to_ident(*u))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ use opt_vec::OptVec;
|
|||
|
||||
pub enum fn_kind<'self> {
|
||||
// fn foo() or extern "Abi" fn foo()
|
||||
fk_item_fn(ident, &'self Generics, purity, AbiSet),
|
||||
fk_item_fn(Ident, &'self Generics, purity, AbiSet),
|
||||
|
||||
// fn foo(&self)
|
||||
fk_method(ident, &'self Generics, &'self method),
|
||||
fk_method(Ident, &'self Generics, &'self method),
|
||||
|
||||
// @fn(x, y) { ... }
|
||||
fk_anon(ast::Sigil),
|
||||
|
|
@ -42,7 +42,7 @@ pub enum fn_kind<'self> {
|
|||
fk_fn_block,
|
||||
}
|
||||
|
||||
pub fn name_of_fn(fk: &fn_kind) -> ident {
|
||||
pub fn name_of_fn(fk: &fn_kind) -> Ident {
|
||||
match *fk {
|
||||
fk_item_fn(name, _, _, _) | fk_method(name, _, _) => {
|
||||
name
|
||||
|
|
@ -86,7 +86,7 @@ pub trait Visitor<E:Clone> {
|
|||
}
|
||||
fn visit_ty_method(&mut self, t:&TypeMethod, e:E) { walk_ty_method(self, t, e) }
|
||||
fn visit_trait_method(&mut self, t:&trait_method, e:E) { walk_trait_method(self, t, e) }
|
||||
fn visit_struct_def(&mut self, s:@struct_def, i:ident, g:&Generics, n:NodeId, e:E) {
|
||||
fn visit_struct_def(&mut self, s:@struct_def, i:Ident, g:&Generics, n:NodeId, e:E) {
|
||||
walk_struct_def(self, s, i, g, n, e)
|
||||
}
|
||||
fn visit_struct_field(&mut self, s:@struct_field, e:E) { walk_struct_field(self, s, e) }
|
||||
|
|
@ -144,7 +144,7 @@ impl<E:Clone> Visitor<E> for @mut Visitor<E> {
|
|||
fn visit_trait_method(&mut self, a:&trait_method, e:E) {
|
||||
(*self).visit_trait_method(a, e)
|
||||
}
|
||||
fn visit_struct_def(&mut self, a:@struct_def, b:ident, c:&Generics, d:NodeId, e:E) {
|
||||
fn visit_struct_def(&mut self, a:@struct_def, b:Ident, c:&Generics, d:NodeId, e:E) {
|
||||
(*self).visit_struct_def(a, b, c, d, e)
|
||||
}
|
||||
fn visit_struct_field(&mut self, a:@struct_field, e:E) {
|
||||
|
|
@ -476,7 +476,7 @@ pub fn walk_trait_method<E:Clone, V:Visitor<E>>(visitor: &mut V,
|
|||
|
||||
pub fn walk_struct_def<E:Clone, V:Visitor<E>>(visitor: &mut V,
|
||||
struct_definition: @struct_def,
|
||||
_: ast::ident,
|
||||
_: ast::Ident,
|
||||
_: &Generics,
|
||||
_: NodeId,
|
||||
env: E) {
|
||||
|
|
@ -693,7 +693,7 @@ pub trait SimpleVisitor {
|
|||
fn visit_fn(&mut self, &fn_kind, &fn_decl, &Block, Span, NodeId);
|
||||
fn visit_ty_method(&mut self, &TypeMethod);
|
||||
fn visit_trait_method(&mut self, &trait_method);
|
||||
fn visit_struct_def(&mut self, @struct_def, ident, &Generics, NodeId);
|
||||
fn visit_struct_def(&mut self, @struct_def, Ident, &Generics, NodeId);
|
||||
fn visit_struct_field(&mut self, @struct_field);
|
||||
fn visit_struct_method(&mut self, @method);
|
||||
}
|
||||
|
|
@ -792,7 +792,7 @@ impl Visitor<()> for SimpleVisitorVisitor {
|
|||
}
|
||||
fn visit_struct_def(&mut self,
|
||||
struct_definition: @struct_def,
|
||||
identifier: ident,
|
||||
identifier: Ident,
|
||||
generics: &Generics,
|
||||
node_id: NodeId,
|
||||
env: ()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue