syntax: de-mode and prepare for de-modeing rustc

This commit is contained in:
Alex Crichton 2013-04-17 12:15:08 -04:00
parent be9f4ef65f
commit 3c7aea3a6a
30 changed files with 363 additions and 364 deletions

View file

@ -255,13 +255,13 @@ pub impl AbiSet {
}
impl to_bytes::IterBytes for Abi {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
self.index().iter_bytes(lsb0, f)
}
}
impl to_bytes::IterBytes for AbiSet {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
self.bits.iter_bytes(lsb0, f)
}
}

View file

@ -97,7 +97,7 @@ impl<D:Decoder> Decodable<D> for ident {
}
impl to_bytes::IterBytes for ident {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
self.repr.iter_bytes(lsb0, f)
}
}
@ -284,7 +284,7 @@ pub enum binding_mode {
}
impl to_bytes::IterBytes for binding_mode {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
match *self {
bind_by_copy => 0u8.iter_bytes(lsb0, f),
@ -330,7 +330,7 @@ pub enum pat_ {
pub enum mutability { m_mutbl, m_imm, m_const, }
impl to_bytes::IterBytes for mutability {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -345,7 +345,7 @@ pub enum Sigil {
}
impl to_bytes::IterBytes for Sigil {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as uint).iter_bytes(lsb0, f)
}
}
@ -428,7 +428,7 @@ pub enum inferable<T> {
}
impl<T:to_bytes::IterBytes> to_bytes::IterBytes for inferable<T> {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
match *self {
expl(ref t) =>
to_bytes::iter_bytes_2(&0u8, t, lsb0, f),
@ -446,7 +446,7 @@ impl<T:to_bytes::IterBytes> to_bytes::IterBytes for inferable<T> {
pub enum rmode { by_ref, by_copy }
impl to_bytes::IterBytes for rmode {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -781,7 +781,7 @@ impl ToStr for int_ty {
}
impl to_bytes::IterBytes for int_ty {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -798,7 +798,7 @@ impl ToStr for uint_ty {
}
impl to_bytes::IterBytes for uint_ty {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -815,7 +815,7 @@ impl ToStr for float_ty {
}
impl to_bytes::IterBytes for float_ty {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -860,7 +860,7 @@ impl ToStr for Onceness {
}
impl to_bytes::IterBytes for Onceness {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as uint).iter_bytes(lsb0, f);
}
}
@ -911,7 +911,7 @@ pub enum ty_ {
}
impl to_bytes::IterBytes for Ty {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
to_bytes::iter_bytes_2(&self.span.lo, &self.span.hi, lsb0, f);
}
}
@ -979,7 +979,7 @@ impl ToStr for purity {
}
impl to_bytes::IterBytes for purity {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -994,7 +994,7 @@ pub enum ret_style {
}
impl to_bytes::IterBytes for ret_style {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -1268,7 +1268,7 @@ pub enum item_ {
pub enum struct_mutability { struct_mutable, struct_immutable }
impl to_bytes::IterBytes for struct_mutability {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}

View file

@ -115,7 +115,7 @@ pub struct Ctx {
pub type vt = visit::vt<@mut Ctx>;
pub fn extend(cx: @mut Ctx, +elt: ident) -> @path {
pub fn extend(cx: @mut Ctx, elt: ident) -> @path {
@(vec::append(copy cx.path, ~[path_name(elt)]))
}
@ -132,7 +132,7 @@ pub fn mk_ast_map_visitor() -> vt {
});
}
pub fn map_crate(diag: @span_handler, c: crate) -> map {
pub fn map_crate(diag: @span_handler, c: @crate) -> map {
let cx = @mut Ctx {
map: @mut HashMap::new(),
path: ~[],
@ -148,8 +148,8 @@ pub fn map_crate(diag: @span_handler, c: crate) -> map {
// the item itself.
pub fn map_decoded_item(diag: @span_handler,
map: map,
+path: path,
ii: inlined_item) {
path: path,
ii: &inlined_item) {
// I believe it is ok for the local IDs of inlined items from other crates
// to overlap with the local ids from this crate, so just generate the ids
// starting from 0. (In particular, I think these ids are only used in
@ -167,7 +167,7 @@ pub fn map_decoded_item(diag: @span_handler,
// methods get added to the AST map when their impl is visited. Since we
// don't decode and instantiate the impl, but just the method, we have to
// add it to the table now:
match ii {
match *ii {
ii_item(*) | ii_dtor(*) => { /* fallthrough */ }
ii_foreign(i) => {
cx.map.insert(i.id, node_foreign_item(i,
@ -190,7 +190,7 @@ pub fn map_fn(
body: &blk,
sp: codemap::span,
id: node_id,
&&cx: @mut Ctx,
cx: @mut Ctx,
v: visit::vt<@mut Ctx>
) {
for decl.inputs.each |a| {
@ -222,7 +222,7 @@ pub fn map_fn(
visit::visit_fn(fk, decl, body, sp, id, cx, v);
}
pub fn map_block(b: &blk, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_block(b: &blk, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
cx.map.insert(b.node.id, node_block(/* FIXME (#2543) */ copy *b));
visit::visit_block(b, cx, v);
}
@ -239,24 +239,24 @@ pub fn number_pat(cx: @mut Ctx, pat: @pat) {
};
}
pub fn map_local(loc: @local, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_local(loc: @local, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
number_pat(cx, loc.node.pat);
visit::visit_local(loc, cx, v);
}
pub fn map_arm(arm: &arm, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_arm(arm: &arm, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
number_pat(cx, arm.pats[0]);
visit::visit_arm(arm, cx, v);
}
pub fn map_method(impl_did: def_id, impl_path: @path,
m: @method, &&cx: @mut Ctx) {
m: @method, cx: @mut Ctx) {
cx.map.insert(m.id, node_method(m, impl_did, impl_path));
cx.map.insert(m.self_id, node_local(cx.local_id));
cx.local_id += 1u;
}
pub fn map_item(i: @item, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_item(i: @item, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
let item_path = @/* FIXME (#2543) */ copy cx.path;
cx.map.insert(i.id, node_item(i, item_path));
match i.node {
@ -355,13 +355,13 @@ pub fn map_struct_def(
}
}
pub fn map_expr(ex: @expr, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_expr(ex: @expr, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
cx.map.insert(ex.id, node_expr(ex));
visit::visit_expr(ex, cx, v);
}
pub fn map_stmt(stmt: @stmt, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
cx.map.insert(stmt_id(*stmt), node_stmt(stmt));
pub fn map_stmt(stmt: @stmt, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
cx.map.insert(stmt_id(stmt), node_stmt(stmt));
visit::visit_stmt(stmt, cx, v);
}
@ -408,7 +408,7 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
}
Some(&node_stmt(stmt)) => {
fmt!("stmt %s (id=%?)",
pprust::stmt_to_str(*stmt, itr), id)
pprust::stmt_to_str(stmt, itr), id)
}
Some(&node_arg(_, _)) => { // add more info here
fmt!("arg (id=%?)", id)
@ -430,7 +430,7 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
pub fn node_item_query<Result>(items: map, id: node_id,
query: &fn(@item) -> Result,
+error_msg: ~str) -> Result {
error_msg: ~str) -> Result {
match items.find(&id) {
Some(&node_item(it, _)) => query(it),
_ => fail!(error_msg)

View file

@ -39,7 +39,7 @@ pub fn local_def(id: node_id) -> def_id {
pub fn is_local(did: ast::def_id) -> bool { did.crate == local_crate }
pub fn stmt_id(s: stmt) -> node_id {
pub fn stmt_id(s: &stmt) -> node_id {
match s.node {
stmt_decl(_, id) => id,
stmt_expr(_, id) => id,
@ -200,7 +200,7 @@ pub fn is_call_expr(e: @expr) -> bool {
// This makes def_id hashable
impl to_bytes::IterBytes for def_id {
#[inline(always)]
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
to_bytes::iter_bytes_2(&self.crate, &self.node, lsb0, f);
}
}
@ -211,7 +211,7 @@ pub fn block_from_expr(e: @expr) -> blk {
}
pub fn default_block(
+stmts1: ~[@stmt],
stmts1: ~[@stmt],
expr1: Option<@expr>,
id1: node_id
) -> blk_ {
@ -224,7 +224,7 @@ pub fn default_block(
}
}
pub fn ident_to_path(s: span, +i: ident) -> @Path {
pub fn ident_to_path(s: span, i: ident) -> @Path {
@ast::Path { span: s,
global: false,
idents: ~[i],
@ -232,7 +232,7 @@ pub fn ident_to_path(s: span, +i: ident) -> @Path {
types: ~[] }
}
pub fn ident_to_pat(id: node_id, s: span, +i: ident) -> @pat {
pub fn ident_to_pat(id: node_id, s: span, i: ident) -> @pat {
@ast::pat { id: id,
node: pat_ident(bind_by_copy, ident_to_path(s, i), None),
span: s }
@ -300,7 +300,7 @@ pub fn struct_field_visibility(field: ast::struct_field) -> visibility {
pub trait inlined_item_utils {
fn ident(&self) -> ident;
fn id(&self) -> ast::node_id;
fn accept<E>(&self, e: E, v: visit::vt<E>);
fn accept<E: Copy>(&self, e: E, v: visit::vt<E>);
}
impl inlined_item_utils for inlined_item {
@ -322,7 +322,7 @@ impl inlined_item_utils for inlined_item {
}
}
fn accept<E>(&self, e: E, v: visit::vt<E>) {
fn accept<E: Copy>(&self, e: E, v: visit::vt<E>) {
match *self {
ii_item(i) => (v.visit_item)(i, e, v),
ii_foreign(i) => (v.visit_foreign_item)(i, e, v),
@ -435,7 +435,7 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
visit_local: |l| vfn(l.node.id),
visit_block: |b| vfn(b.node.id),
visit_stmt: |s| vfn(ast_util::stmt_id(*s)),
visit_stmt: |s| vfn(ast_util::stmt_id(s)),
visit_arm: |_| {},
visit_pat: |p| vfn(p.id),
visit_decl: |_| {},
@ -491,7 +491,7 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
})
}
pub fn visit_ids_for_inlined_item(item: inlined_item, vfn: @fn(node_id)) {
pub fn visit_ids_for_inlined_item(item: &inlined_item, vfn: @fn(node_id)) {
item.accept((), id_visitor(vfn));
}
@ -505,7 +505,7 @@ pub fn compute_id_range(visit_ids_fn: &fn(@fn(node_id))) -> id_range {
id_range { min: *min, max: *max }
}
pub fn compute_id_range_for_inlined_item(item: inlined_item) -> id_range {
pub fn compute_id_range_for_inlined_item(item: &inlined_item) -> id_range {
compute_id_range(|f| visit_ids_for_inlined_item(item, f))
}
@ -609,7 +609,7 @@ pub fn mk_rename (id:ident, to:Name, tail:SyntaxContext, table: &mut SCTable)
pub fn mk_sctable() -> SCTable { ~[EmptyCtxt] }
/// Add a value to the end of a vec, return its index
fn idx_push<T>(vec: &mut ~[T], +val: T) -> uint {
fn idx_push<T>(vec: &mut ~[T], val: T) -> uint {
vec.push(val);
vec.len() - 1
}

View file

@ -31,12 +31,12 @@ pub fn mk_name_value_item_str(name: @~str, value: @~str)
mk_name_value_item(name, value_lit)
}
pub fn mk_name_value_item(name: @~str, +value: ast::lit)
pub fn mk_name_value_item(name: @~str, value: ast::lit)
-> @ast::meta_item {
@dummy_spanned(ast::meta_name_value(name, value))
}
pub fn mk_list_item(name: @~str, +items: ~[@ast::meta_item]) ->
pub fn mk_list_item(name: @~str, items: ~[@ast::meta_item]) ->
@ast::meta_item {
@dummy_spanned(ast::meta_list(name, items))
}
@ -51,8 +51,8 @@ pub fn mk_attr(item: @ast::meta_item) -> ast::attribute {
is_sugared_doc: false })
}
pub fn mk_sugared_doc_attr(+text: ~str,
+lo: BytePos, +hi: BytePos) -> ast::attribute {
pub fn mk_sugared_doc_attr(text: ~str,
lo: BytePos, hi: BytePos) -> ast::attribute {
let style = doc_comment_style(text);
let lit = spanned(lo, hi, ast::lit_str(@text));
let attr = ast::attribute_ {

View file

@ -71,7 +71,7 @@ impl Sub<BytePos, BytePos> for BytePos {
}
impl to_bytes::IterBytes for BytePos {
fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(**self).iter_bytes(lsb0, f)
}
}
@ -89,7 +89,7 @@ impl cmp::Ord for CharPos {
}
impl to_bytes::IterBytes for CharPos {
fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(**self).iter_bytes(lsb0, f)
}
}
@ -141,20 +141,20 @@ impl<D:Decoder> Decodable<D> for span {
}
}
pub fn spanned<T>(+lo: BytePos, +hi: BytePos, +t: T) -> spanned<T> {
pub fn spanned<T>(lo: BytePos, hi: BytePos, t: T) -> spanned<T> {
respan(mk_sp(lo, hi), t)
}
pub fn respan<T>(sp: span, +t: T) -> spanned<T> {
pub fn respan<T>(sp: span, t: T) -> spanned<T> {
spanned {node: t, span: sp}
}
pub fn dummy_spanned<T>(+t: T) -> spanned<T> {
pub fn dummy_spanned<T>(t: T) -> spanned<T> {
respan(dummy_sp(), t)
}
/* assuming that we're not in macro expansion */
pub fn mk_sp(+lo: BytePos, +hi: BytePos) -> span {
pub fn mk_sp(lo: BytePos, hi: BytePos) -> span {
span {lo: lo, hi: hi, expn_info: None}
}
@ -247,7 +247,7 @@ pub impl FileMap {
// UNCHECKED INVARIANT: these offsets must be added in the right
// order and must be in the right places; there is shared knowledge
// about what ends a line between this file and parse.rs
fn next_line(&self, +pos: BytePos) {
fn next_line(&self, pos: BytePos) {
// the new charpos must be > the last one (or it's the first one).
let lines = &mut *self.lines;
assert!((lines.len() == 0) || (lines[lines.len() - 1] < pos));
@ -287,14 +287,14 @@ pub impl CodeMap {
}
/// Add a new FileMap to the CodeMap and return it
fn new_filemap(&self, +filename: FileName, src: @~str) -> @FileMap {
fn new_filemap(&self, filename: FileName, src: @~str) -> @FileMap {
return self.new_filemap_w_substr(filename, FssNone, src);
}
fn new_filemap_w_substr(
&self,
+filename: FileName,
+substr: FileSubstr,
filename: FileName,
substr: FileSubstr,
src: @~str
) -> @FileMap {
let files = &mut *self.files;
@ -325,11 +325,11 @@ pub impl CodeMap {
}
/// Lookup source information about a BytePos
pub fn lookup_char_pos(&self, +pos: BytePos) -> Loc {
pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
return self.lookup_pos(pos);
}
pub fn lookup_char_pos_adj(&self, +pos: BytePos) -> LocWithOpt
pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt
{
let loc = self.lookup_char_pos(pos);
match (loc.file.substr) {
@ -405,7 +405,7 @@ pub impl CodeMap {
priv impl CodeMap {
fn lookup_filemap_idx(&self, +pos: BytePos) -> uint {
fn lookup_filemap_idx(&self, pos: BytePos) -> uint {
let files = &*self.files;
let len = files.len();
let mut a = 0u;
@ -440,7 +440,7 @@ priv impl CodeMap {
return FileMapAndLine {fm: f, line: a};
}
fn lookup_pos(&self, +pos: BytePos) -> Loc {
fn lookup_pos(&self, pos: BytePos) -> Loc {
let FileMapAndLine {fm: f, line: a} = self.lookup_line(pos);
let line = a + 1u; // Line numbers start at 1
let chpos = self.bytepos_to_local_charpos(pos);
@ -466,7 +466,7 @@ priv impl CodeMap {
lo.line, lo.col.to_uint(), hi.line, hi.col.to_uint())
}
fn lookup_byte_offset(&self, +bpos: BytePos)
fn lookup_byte_offset(&self, bpos: BytePos)
-> FileMapAndBytePos {
let idx = self.lookup_filemap_idx(bpos);
let fm = self.files[idx];
@ -476,7 +476,7 @@ priv impl CodeMap {
// Converts an absolute BytePos to a CharPos relative to the file it is
// located in
fn bytepos_to_local_charpos(&self, +bpos: BytePos) -> CharPos {
fn bytepos_to_local_charpos(&self, bpos: BytePos) -> CharPos {
debug!("codemap: converting %? to char pos", bpos);
let idx = self.lookup_filemap_idx(bpos);
let map = self.files[idx];

View file

@ -239,7 +239,7 @@ priv impl @ext_ctxt {
}
}
fn expr(&self, span: span, +node: ast::expr_) -> @ast::expr {
fn expr(&self, span: span, node: ast::expr_) -> @ast::expr {
@ast::expr {
id: self.next_id(),
callee_id: self.next_id(),
@ -248,7 +248,7 @@ priv impl @ext_ctxt {
}
}
fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
fn path(&self, span: span, strs: ~[ast::ident]) -> @ast::Path {
@ast::Path {
span: span,
global: false,
@ -258,7 +258,7 @@ priv impl @ext_ctxt {
}
}
fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
fn path_global(&self, span: span, strs: ~[ast::ident]) -> @ast::Path {
@ast::Path {
span: span,
global: true,
@ -271,8 +271,8 @@ priv impl @ext_ctxt {
fn path_tps(
&self,
span: span,
+strs: ~[ast::ident],
+tps: ~[@ast::Ty]
strs: ~[ast::ident],
tps: ~[@ast::Ty]
) -> @ast::Path {
@ast::Path {
span: span,
@ -286,8 +286,8 @@ priv impl @ext_ctxt {
fn path_tps_global(
&self,
span: span,
+strs: ~[ast::ident],
+tps: ~[@ast::Ty]
strs: ~[ast::ident],
tps: ~[@ast::Ty]
) -> @ast::Path {
@ast::Path {
span: span,
@ -301,8 +301,8 @@ priv impl @ext_ctxt {
fn ty_path(
&self,
span: span,
+strs: ~[ast::ident],
+tps: ~[@ast::Ty]
strs: ~[ast::ident],
tps: ~[@ast::Ty]
) -> @ast::Ty {
@ast::Ty {
id: self.next_id(),
@ -349,13 +349,13 @@ priv impl @ext_ctxt {
span: span}))
}
fn lambda(&self, +blk: ast::blk) -> @ast::expr {
fn lambda(&self, blk: ast::blk) -> @ast::expr {
let ext_cx = *self;
let blk_e = self.expr(copy blk.span, ast::expr_block(copy blk));
quote_expr!( || $blk_e )
}
fn blk(&self, span: span, +stmts: ~[@ast::stmt]) -> ast::blk {
fn blk(&self, span: span, stmts: ~[@ast::stmt]) -> ast::blk {
codemap::spanned {
node: ast::blk_ {
view_items: ~[],
@ -381,19 +381,19 @@ priv impl @ext_ctxt {
}
}
fn expr_path(&self, span: span, +strs: ~[ast::ident]) -> @ast::expr {
fn expr_path(&self, span: span, strs: ~[ast::ident]) -> @ast::expr {
self.expr(span, ast::expr_path(self.path(span, strs)))
}
fn expr_path_global(
&self,
span: span,
+strs: ~[ast::ident]
strs: ~[ast::ident]
) -> @ast::expr {
self.expr(span, ast::expr_path(self.path_global(span, strs)))
}
fn expr_var(&self, span: span, +var: ~str) -> @ast::expr {
fn expr_var(&self, span: span, var: ~str) -> @ast::expr {
self.expr_path(span, ~[self.ident_of(var)])
}
@ -410,7 +410,7 @@ priv impl @ext_ctxt {
&self,
span: span,
expr: @ast::expr,
+args: ~[@ast::expr]
args: ~[@ast::expr]
) -> @ast::expr {
self.expr(span, ast::expr_call(expr, args, ast::NoSugar))
}
@ -420,7 +420,7 @@ priv impl @ext_ctxt {
span: span,
expr: @ast::expr,
ident: ast::ident,
+args: ~[@ast::expr]
args: ~[@ast::expr]
) -> @ast::expr {
self.expr(span, ast::expr_method_call(expr, ident, ~[], args, ast::NoSugar))
}
@ -429,7 +429,7 @@ priv impl @ext_ctxt {
self.lambda(self.expr_blk(expr))
}
fn lambda_stmts(&self, span: span, +stmts: ~[@ast::stmt]) -> @ast::expr {
fn lambda_stmts(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr {
self.lambda(self.blk(span, stmts))
}
}
@ -597,7 +597,7 @@ fn mk_deser_impl(
fn mk_ser_method(
cx: @ext_ctxt,
span: span,
+ser_body: ast::blk
ser_body: ast::blk
) -> @ast::method {
let ty_s = @ast::Ty {
id: cx.next_id(),
@ -660,7 +660,7 @@ fn mk_deser_method(
cx: @ext_ctxt,
span: span,
ty: @ast::Ty,
+deser_body: ast::blk
deser_body: ast::blk
) -> @ast::method {
let ty_d = @ast::Ty {
id: cx.next_id(),
@ -864,7 +864,7 @@ fn mk_enum_ser_impl(
cx: @ext_ctxt,
span: span,
ident: ast::ident,
+enum_def: ast::enum_def,
enum_def: ast::enum_def,
generics: &ast::Generics
) -> @ast::item {
let body = mk_enum_ser_body(
@ -881,7 +881,7 @@ fn mk_enum_deser_impl(
cx: @ext_ctxt,
span: span,
ident: ast::ident,
+enum_def: ast::enum_def,
enum_def: ast::enum_def,
generics: &ast::Generics
) -> @ast::item {
let body = mk_enum_deser_body(
@ -974,7 +974,7 @@ fn mk_enum_ser_body(
cx: @ext_ctxt,
span: span,
name: ast::ident,
+variants: ~[ast::variant]
variants: ~[ast::variant]
) -> @ast::expr {
let arms = do variants.mapi |v_idx, variant| {
match variant.node.kind {
@ -1219,37 +1219,37 @@ mod test {
impl Encoder for TestEncoder {
fn emit_nil(&self) { self.add_to_log(CallToEmitNil) }
fn emit_uint(&self, +v: uint) {self.add_to_log(CallToEmitUint(v)); }
fn emit_u64(&self, +_v: u64) { self.add_unknown_to_log(); }
fn emit_u32(&self, +_v: u32) { self.add_unknown_to_log(); }
fn emit_u16(&self, +_v: u16) { self.add_unknown_to_log(); }
fn emit_u8(&self, +_v: u8) { self.add_unknown_to_log(); }
fn emit_uint(&self, v: uint) {self.add_to_log(CallToEmitUint(v)); }
fn emit_u64(&self, _v: u64) { self.add_unknown_to_log(); }
fn emit_u32(&self, _v: u32) { self.add_unknown_to_log(); }
fn emit_u16(&self, _v: u16) { self.add_unknown_to_log(); }
fn emit_u8(&self, _v: u8) { self.add_unknown_to_log(); }
fn emit_int(&self, +_v: int) { self.add_unknown_to_log(); }
fn emit_i64(&self, +_v: i64) { self.add_unknown_to_log(); }
fn emit_i32(&self, +_v: i32) { self.add_unknown_to_log(); }
fn emit_i16(&self, +_v: i16) { self.add_unknown_to_log(); }
fn emit_i8(&self, +_v: i8) { self.add_unknown_to_log(); }
fn emit_int(&self, _v: int) { self.add_unknown_to_log(); }
fn emit_i64(&self, _v: i64) { self.add_unknown_to_log(); }
fn emit_i32(&self, _v: i32) { self.add_unknown_to_log(); }
fn emit_i16(&self, _v: i16) { self.add_unknown_to_log(); }
fn emit_i8(&self, _v: i8) { self.add_unknown_to_log(); }
fn emit_bool(&self, +_v: bool) { self.add_unknown_to_log(); }
fn emit_bool(&self, _v: bool) { self.add_unknown_to_log(); }
fn emit_f64(&self, +_v: f64) { self.add_unknown_to_log(); }
fn emit_f32(&self, +_v: f32) { self.add_unknown_to_log(); }
fn emit_float(&self, +_v: float) { self.add_unknown_to_log(); }
fn emit_f64(&self, _v: f64) { self.add_unknown_to_log(); }
fn emit_f32(&self, _v: f32) { self.add_unknown_to_log(); }
fn emit_float(&self, _v: float) { self.add_unknown_to_log(); }
fn emit_char(&self, +_v: char) { self.add_unknown_to_log(); }
fn emit_str(&self, +_v: &str) { self.add_unknown_to_log(); }
fn emit_char(&self, _v: char) { self.add_unknown_to_log(); }
fn emit_str(&self, _v: &str) { self.add_unknown_to_log(); }
fn emit_enum(&self, name: &str, f: &fn()) {
self.add_to_log(CallToEmitEnum(name.to_str())); f(); }
fn emit_enum_variant(&self, name: &str, +id: uint,
+cnt: uint, f: &fn()) {
fn emit_enum_variant(&self, name: &str, id: uint,
cnt: uint, f: &fn()) {
self.add_to_log(CallToEmitEnumVariant (name.to_str(),id,cnt));
f();
}
fn emit_enum_variant_arg(&self, +idx: uint, f: &fn()) {
fn emit_enum_variant_arg(&self, idx: uint, f: &fn()) {
self.add_to_log(CallToEmitEnumVariantArg (idx)); f();
}
@ -1261,10 +1261,10 @@ mod test {
self.emit_enum_variant_arg(idx, f)
}
fn emit_struct(&self, name: &str, +len: uint, f: &fn()) {
fn emit_struct(&self, name: &str, len: uint, f: &fn()) {
self.add_to_log(CallToEmitStruct (name.to_str(),len)); f();
}
fn emit_struct_field(&self, name: &str, +idx: uint, f: &fn()) {
fn emit_struct_field(&self, name: &str, idx: uint, f: &fn()) {
self.add_to_log(CallToEmitField (name.to_str(),idx)); f();
}
@ -1294,10 +1294,10 @@ mod test {
f();
}
fn emit_seq(&self, +_len: uint, f: &fn()) {
fn emit_seq(&self, _len: uint, f: &fn()) {
self.add_unknown_to_log(); f();
}
fn emit_seq_elt(&self, +_idx: uint, f: &fn()) {
fn emit_seq_elt(&self, _idx: uint, f: &fn()) {
self.add_unknown_to_log(); f();
}

View file

@ -238,7 +238,7 @@ pub trait ext_ctxt {
fn ident_of(@mut self, st: ~str) -> ast::ident;
}
pub fn mk_ctxt(parse_sess: @mut parse::ParseSess, +cfg: ast::crate_cfg)
pub fn mk_ctxt(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg)
-> @ext_ctxt {
struct CtxtRepr {
parse_sess: @mut parse::ParseSess,
@ -439,7 +439,7 @@ pub enum MapChain<K,V> {
impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
// Constructor. I don't think we need a zero-arg one.
fn new(+init: ~HashMap<K,@V>) -> @mut MapChain<K,V> {
fn new(init: ~HashMap<K,@V>) -> @mut MapChain<K,V> {
@mut BaseMapChain(init)
}
@ -509,7 +509,7 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
}
// insert the binding into the top-level map
fn insert (&mut self, +key: K, +ext: @V) -> bool {
fn insert (&mut self, key: K, ext: @V) -> bool {
// can't abstract over get_map because of flow sensitivity...
match *self {
BaseMapChain (~ref mut map) => map.insert(key, ext),

View file

@ -27,7 +27,7 @@ pub struct Field {
pub fn mk_expr(cx: @ext_ctxt,
sp: codemap::span,
+expr: ast::expr_)
expr: ast::expr_)
-> @ast::expr {
@ast::expr {
id: cx.next_id(),
@ -63,12 +63,12 @@ pub fn mk_unary(cx: @ext_ctxt, sp: span, op: ast::unop, e: @ast::expr)
cx.next_id(); // see ast_util::op_expr_callee_id
mk_expr(cx, sp, ast::expr_unary(op, e))
}
pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::Path {
pub fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::Path {
mk_raw_path_(sp, idents, ~[])
}
pub fn mk_raw_path_(sp: span,
+idents: ~[ast::ident],
+types: ~[@ast::Ty])
idents: ~[ast::ident],
types: ~[@ast::Ty])
-> @ast::Path {
@ast::Path { span: sp,
global: false,
@ -76,23 +76,23 @@ pub fn mk_raw_path_(sp: span,
rp: None,
types: types }
}
pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::Path {
pub fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::Path {
mk_raw_path_global_(sp, idents, ~[])
}
pub fn mk_raw_path_global_(sp: span,
+idents: ~[ast::ident],
+types: ~[@ast::Ty]) -> @ast::Path {
idents: ~[ast::ident],
types: ~[@ast::Ty]) -> @ast::Path {
@ast::Path { span: sp,
global: true,
idents: idents,
rp: None,
types: types }
}
pub fn mk_path(cx: @ext_ctxt, sp: span, +idents: ~[ast::ident])
pub fn mk_path(cx: @ext_ctxt, sp: span, idents: ~[ast::ident])
-> @ast::expr {
mk_expr(cx, sp, ast::expr_path(mk_raw_path(sp, idents)))
}
pub fn mk_path_global(cx: @ext_ctxt, sp: span, +idents: ~[ast::ident])
pub fn mk_path_global(cx: @ext_ctxt, sp: span, idents: ~[ast::ident])
-> @ast::expr {
mk_expr(cx, sp, ast::expr_path(mk_raw_path_global(sp, idents)))
}
@ -100,7 +100,7 @@ pub fn mk_access_(cx: @ext_ctxt, sp: span, p: @ast::expr, m: ast::ident)
-> @ast::expr {
mk_expr(cx, sp, ast::expr_field(p, m, ~[]))
}
pub fn mk_access(cx: @ext_ctxt, sp: span, +p: ~[ast::ident], m: ast::ident)
pub fn mk_access(cx: @ext_ctxt, sp: span, p: ~[ast::ident], m: ast::ident)
-> @ast::expr {
let pathexpr = mk_path(cx, sp, p);
return mk_access_(cx, sp, pathexpr, m);
@ -115,25 +115,25 @@ pub fn mk_method_call(cx: @ext_ctxt,
sp: span,
rcvr_expr: @ast::expr,
method_ident: ast::ident,
+args: ~[@ast::expr]) -> @ast::expr {
args: ~[@ast::expr]) -> @ast::expr {
mk_expr(cx, sp, ast::expr_method_call(rcvr_expr, method_ident, ~[], args, ast::NoSugar))
}
pub fn mk_call_(cx: @ext_ctxt, sp: span, fn_expr: @ast::expr,
+args: ~[@ast::expr]) -> @ast::expr {
args: ~[@ast::expr]) -> @ast::expr {
mk_expr(cx, sp, ast::expr_call(fn_expr, args, ast::NoSugar))
}
pub fn mk_call(cx: @ext_ctxt, sp: span, +fn_path: ~[ast::ident],
+args: ~[@ast::expr]) -> @ast::expr {
pub fn mk_call(cx: @ext_ctxt, sp: span, fn_path: ~[ast::ident],
args: ~[@ast::expr]) -> @ast::expr {
let pathexpr = mk_path(cx, sp, fn_path);
return mk_call_(cx, sp, pathexpr, args);
}
pub fn mk_call_global(cx: @ext_ctxt, sp: span, +fn_path: ~[ast::ident],
+args: ~[@ast::expr]) -> @ast::expr {
pub fn mk_call_global(cx: @ext_ctxt, sp: span, fn_path: ~[ast::ident],
args: ~[@ast::expr]) -> @ast::expr {
let pathexpr = mk_path_global(cx, sp, fn_path);
return mk_call_(cx, sp, pathexpr, args);
}
// e = expr, t = type
pub fn mk_base_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
pub fn mk_base_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr])
-> @ast::expr {
let vecexpr = ast::expr_vec(exprs, ast::m_imm);
mk_expr(cx, sp, vecexpr)
@ -143,20 +143,20 @@ pub fn mk_vstore_e(cx: @ext_ctxt, sp: span, expr: @ast::expr,
@ast::expr {
mk_expr(cx, sp, ast::expr_vstore(expr, vst))
}
pub fn mk_uniq_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
pub fn mk_uniq_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr])
-> @ast::expr {
mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs), ast::expr_vstore_uniq)
}
pub fn mk_slice_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
pub fn mk_slice_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr])
-> @ast::expr {
mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs),
ast::expr_vstore_slice)
}
pub fn mk_base_str(cx: @ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
pub fn mk_base_str(cx: @ext_ctxt, sp: span, s: ~str) -> @ast::expr {
let lit = ast::lit_str(@s);
return mk_lit(cx, sp, lit);
}
pub fn mk_uniq_str(cx: @ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
pub fn mk_uniq_str(cx: @ext_ctxt, sp: span, s: ~str) -> @ast::expr {
mk_vstore_e(cx, sp, mk_base_str(cx, sp, s), ast::expr_vstore_uniq)
}
pub fn mk_field(sp: span, f: &Field) -> ast::field {
@ -170,8 +170,8 @@ pub fn mk_fields(sp: span, fields: ~[Field]) -> ~[ast::field] {
}
pub fn mk_struct_e(cx: @ext_ctxt,
sp: span,
+ctor_path: ~[ast::ident],
+fields: ~[Field])
ctor_path: ~[ast::ident],
fields: ~[Field])
-> @ast::expr {
mk_expr(cx, sp,
ast::expr_struct(mk_raw_path(sp, ctor_path),
@ -180,8 +180,8 @@ pub fn mk_struct_e(cx: @ext_ctxt,
}
pub fn mk_global_struct_e(cx: @ext_ctxt,
sp: span,
+ctor_path: ~[ast::ident],
+fields: ~[Field])
ctor_path: ~[ast::ident],
fields: ~[Field])
-> @ast::expr {
mk_expr(cx, sp,
ast::expr_struct(mk_raw_path_global(sp, ctor_path),
@ -190,7 +190,7 @@ pub fn mk_global_struct_e(cx: @ext_ctxt,
}
pub fn mk_glob_use(cx: @ext_ctxt,
sp: span,
+path: ~[ast::ident]) -> @ast::view_item {
path: ~[ast::ident]) -> @ast::view_item {
let glob = @codemap::spanned {
node: ast::view_path_glob(mk_raw_path(sp, path), cx.next_id()),
span: sp,
@ -226,8 +226,8 @@ pub fn mk_local(cx: @ext_ctxt, sp: span, mutbl: bool,
@codemap::spanned { node: ast::stmt_decl(@decl, cx.next_id()), span: sp }
}
pub fn mk_block(cx: @ext_ctxt, span: span,
+view_items: ~[@ast::view_item],
+stmts: ~[@ast::stmt],
view_items: ~[@ast::view_item],
stmts: ~[@ast::stmt],
expr: Option<@ast::expr>) -> @ast::expr {
let blk = codemap::spanned {
node: ast::blk_ {
@ -243,7 +243,7 @@ pub fn mk_block(cx: @ext_ctxt, span: span,
}
pub fn mk_block_(cx: @ext_ctxt,
span: span,
+stmts: ~[@ast::stmt])
stmts: ~[@ast::stmt])
-> ast::blk {
codemap::spanned {
node: ast::blk_ {
@ -307,7 +307,7 @@ pub fn mk_copy(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
pub fn mk_managed(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
mk_expr(cx, sp, ast::expr_unary(ast::box(ast::m_imm), e))
}
pub fn mk_pat(cx: @ext_ctxt, span: span, +pat: ast::pat_) -> @ast::pat {
pub fn mk_pat(cx: @ext_ctxt, span: span, pat: ast::pat_) -> @ast::pat {
@ast::pat { id: cx.next_id(), node: pat, span: span }
}
pub fn mk_pat_wild(cx: @ext_ctxt, span: span) -> @ast::pat {
@ -335,7 +335,7 @@ pub fn mk_pat_ident_with_binding_mode(cx: @ext_ctxt,
pub fn mk_pat_enum(cx: @ext_ctxt,
span: span,
path: @ast::Path,
+subpats: ~[@ast::pat])
subpats: ~[@ast::pat])
-> @ast::pat {
let pat = ast::pat_enum(path, Some(subpats));
mk_pat(cx, span, pat)
@ -343,7 +343,7 @@ pub fn mk_pat_enum(cx: @ext_ctxt,
pub fn mk_pat_struct(cx: @ext_ctxt,
span: span,
path: @ast::Path,
+field_pats: ~[ast::field_pat])
field_pats: ~[ast::field_pat])
-> @ast::pat {
let pat = ast::pat_struct(path, field_pats, false);
mk_pat(cx, span, pat)
@ -360,7 +360,7 @@ pub fn mk_stmt(cx: @ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt {
}
pub fn mk_ty_path(cx: @ext_ctxt,
span: span,
+idents: ~[ ast::ident ])
idents: ~[ ast::ident ])
-> @ast::Ty {
let ty = build::mk_raw_path(span, idents);
let ty = ast::ty_path(ty, cx.next_id());
@ -369,7 +369,7 @@ pub fn mk_ty_path(cx: @ext_ctxt,
}
pub fn mk_ty_path_global(cx: @ext_ctxt,
span: span,
+idents: ~[ ast::ident ])
idents: ~[ ast::ident ])
-> @ast::Ty {
let ty = build::mk_raw_path_global(span, idents);
let ty = ast::ty_path(ty, cx.next_id());
@ -399,7 +399,7 @@ pub fn mk_ty_infer(cx: @ext_ctxt, span: span) -> @ast::Ty {
}
pub fn mk_trait_ref_global(cx: @ext_ctxt,
span: span,
+idents: ~[ ast::ident ])
idents: ~[ ast::ident ])
-> @ast::trait_ref
{
mk_trait_ref_(cx, build::mk_raw_path_global(span, idents))
@ -430,12 +430,12 @@ pub fn mk_arg(cx: @ext_ctxt,
id: cx.next_id()
}
}
pub fn mk_fn_decl(+inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl {
pub fn mk_fn_decl(inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl {
ast::fn_decl { inputs: inputs, output: output, cf: ast::return_val }
}
pub fn mk_trait_ty_param_bound_global(cx: @ext_ctxt,
span: span,
+idents: ~[ast::ident])
idents: ~[ast::ident])
-> ast::TyParamBound {
ast::TraitTyParamBound(mk_trait_ref_global(cx, span, idents))
}

View file

@ -91,7 +91,7 @@ fn create_derived_encodable_impl(
fn create_encode_method(
cx: @ext_ctxt,
span: span,
+statements: ~[@stmt]
statements: ~[@stmt]
) -> @method {
// Create the `e` parameter.
let e_arg_type = build::mk_ty_rptr(

View file

@ -64,7 +64,7 @@ fn create_derived_iter_bytes_impl(cx: @ext_ctxt,
// signature of the `iter_bytes` method.
fn create_iter_bytes_method(cx: @ext_ctxt,
span: span,
+statements: ~[@stmt])
statements: ~[@stmt])
-> @method {
// Create the `lsb0` parameter.
let bool_ident = cx.ident_of(~"bool");

View file

@ -142,7 +142,7 @@ pub fn expand_deriving(cx: @ext_ctxt,
result
}
fn create_impl_item(cx: @ext_ctxt, span: span, +item: item_) -> @item {
fn create_impl_item(cx: @ext_ctxt, span: span, item: item_) -> @item {
let doc_attr = respan(span,
ast::lit_str(@~"Automatically derived."));
let doc_attr = respan(span, ast::meta_name_value(@~"doc", doc_attr));

View file

@ -237,8 +237,8 @@ macro_rules! without_macro_scoping(
// Support for item-position macro invocations, exactly the same
// logic as for expression-position macro invocations.
pub fn expand_item_mac(+extsbox: @mut SyntaxEnv,
cx: @ext_ctxt, &&it: @ast::item,
pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
cx: @ext_ctxt, it: @ast::item,
fld: @ast_fold)
-> Option<@ast::item> {
let (pth, tts) = match it.node {

View file

@ -34,7 +34,7 @@ mod syntax {
pub use parse;
}
pub fn path(+ids: ~[ident], span: span) -> @ast::Path {
pub fn path(ids: ~[ident], span: span) -> @ast::Path {
@ast::Path { span: span,
global: false,
idents: ids,
@ -42,7 +42,7 @@ pub fn path(+ids: ~[ident], span: span) -> @ast::Path {
types: ~[] }
}
pub fn path_global(+ids: ~[ident], span: span) -> @ast::Path {
pub fn path_global(ids: ~[ident], span: span) -> @ast::Path {
@ast::Path { span: span,
global: true,
idents: ids,
@ -52,7 +52,7 @@ pub fn path_global(+ids: ~[ident], span: span) -> @ast::Path {
pub trait append_types {
fn add_ty(&self, ty: @ast::Ty) -> @ast::Path;
fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path;
fn add_tys(&self, tys: ~[@ast::Ty]) -> @ast::Path;
}
impl append_types for @ast::Path {
@ -63,7 +63,7 @@ impl append_types for @ast::Path {
}
}
fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path {
fn add_tys(&self, tys: ~[@ast::Ty]) -> @ast::Path {
@ast::Path {
types: vec::append(copy self.types, tys),
.. copy **self
@ -76,63 +76,63 @@ pub trait ext_ctxt_ast_builder {
-> ast::TyParam;
fn arg(&self, name: ident, ty: @ast::Ty) -> ast::arg;
fn expr_block(&self, e: @ast::expr) -> ast::blk;
fn fn_decl(&self, +inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl;
fn item(&self, name: ident, span: span, +node: ast::item_) -> @ast::item;
fn fn_decl(&self, inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl;
fn item(&self, name: ident, span: span, node: ast::item_) -> @ast::item;
fn item_fn_poly(&self,
ame: ident,
+inputs: ~[ast::arg],
inputs: ~[ast::arg],
output: @ast::Ty,
+generics: Generics,
+body: ast::blk) -> @ast::item;
generics: Generics,
body: ast::blk) -> @ast::item;
fn item_fn(&self,
name: ident,
+inputs: ~[ast::arg],
inputs: ~[ast::arg],
output: @ast::Ty,
+body: ast::blk) -> @ast::item;
body: ast::blk) -> @ast::item;
fn item_enum_poly(&self,
name: ident,
span: span,
+enum_definition: ast::enum_def,
+generics: Generics) -> @ast::item;
enum_definition: ast::enum_def,
generics: Generics) -> @ast::item;
fn item_enum(&self,
name: ident,
span: span,
+enum_definition: ast::enum_def) -> @ast::item;
enum_definition: ast::enum_def) -> @ast::item;
fn item_struct_poly(&self,
name: ident,
span: span,
+struct_def: ast::struct_def,
+generics: Generics) -> @ast::item;
struct_def: ast::struct_def,
generics: Generics) -> @ast::item;
fn item_struct(&self,
name: ident,
span: span,
+struct_def: ast::struct_def) -> @ast::item;
struct_def: ast::struct_def) -> @ast::item;
fn struct_expr(&self,
path: @ast::Path,
+fields: ~[ast::field]) -> @ast::expr;
fields: ~[ast::field]) -> @ast::expr;
fn variant(&self,
name: ident,
span: span,
+tys: ~[@ast::Ty]) -> ast::variant;
tys: ~[@ast::Ty]) -> ast::variant;
fn item_mod(&self,
name: ident,
span: span,
+items: ~[@ast::item]) -> @ast::item;
items: ~[@ast::item]) -> @ast::item;
fn ty_path_ast_builder(&self, path: @ast::Path) -> @ast::Ty;
fn item_ty_poly(&self,
name: ident,
span: span,
ty: @ast::Ty,
+generics: Generics) -> @ast::item;
generics: Generics) -> @ast::item;
fn item_ty(&self, name: ident, span: span, ty: @ast::Ty) -> @ast::item;
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, name: ident, ty: @ast::Ty) -> ast::ty_field;
fn field_imm(&self, name: ident, e: @ast::expr) -> ast::field;
fn block(&self, +stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk;
fn block(&self, stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk;
fn stmt_let(&self, ident: ident, e: @ast::expr) -> @ast::stmt;
fn stmt_expr(&self, e: @ast::expr) -> @ast::stmt;
fn block_expr(&self, +b: ast::blk) -> @ast::expr;
fn block_expr(&self, b: ast::blk) -> @ast::expr;
fn ty_option(&self, ty: @ast::Ty) -> @ast::Ty;
fn ty_infer(&self) -> @ast::Ty;
fn ty_nil_ast_builder(&self) -> @ast::Ty;
@ -148,7 +148,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
], dummy_sp()).add_ty(ty))
}
fn block_expr(&self, +b: ast::blk) -> @ast::expr {
fn block_expr(&self, b: ast::blk) -> @ast::expr {
@expr {
id: self.next_id(),
callee_id: self.next_id(),
@ -215,7 +215,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
}
fn block(&self, +stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk {
fn block(&self, stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk {
let blk = ast::blk_ {
view_items: ~[],
stmts: stmts,
@ -231,7 +231,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
self.block(~[], e)
}
fn fn_decl(&self, +inputs: ~[ast::arg],
fn fn_decl(&self, inputs: ~[ast::arg],
output: @ast::Ty) -> ast::fn_decl {
ast::fn_decl {
inputs: inputs,
@ -241,7 +241,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item(&self, name: ident, span: span,
+node: ast::item_) -> @ast::item {
node: ast::item_) -> @ast::item {
// XXX: Would be nice if our generated code didn't violate
// Rust coding conventions
@ -265,10 +265,10 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item_fn_poly(&self, name: ident,
+inputs: ~[ast::arg],
inputs: ~[ast::arg],
output: @ast::Ty,
+generics: Generics,
+body: ast::blk) -> @ast::item {
generics: Generics,
body: ast::blk) -> @ast::item {
self.item(name,
dummy_sp(),
ast::item_fn(self.fn_decl(inputs, output),
@ -280,9 +280,9 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
fn item_fn(&self,
name: ident,
+inputs: ~[ast::arg],
inputs: ~[ast::arg],
output: @ast::Ty,
+body: ast::blk
body: ast::blk
) -> @ast::item {
self.item_fn_poly(
name,
@ -294,13 +294,13 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item_enum_poly(&self, name: ident, span: span,
+enum_definition: ast::enum_def,
+generics: Generics) -> @ast::item {
enum_definition: ast::enum_def,
generics: Generics) -> @ast::item {
self.item(name, span, ast::item_enum(enum_definition, generics))
}
fn item_enum(&self, name: ident, span: span,
+enum_definition: ast::enum_def) -> @ast::item {
enum_definition: ast::enum_def) -> @ast::item {
self.item_enum_poly(name, span, enum_definition,
ast_util::empty_generics())
}
@ -308,7 +308,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
fn item_struct(
&self, name: ident,
span: span,
+struct_def: ast::struct_def
struct_def: ast::struct_def
) -> @ast::item {
self.item_struct_poly(
name,
@ -322,14 +322,14 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
&self,
name: ident,
span: span,
+struct_def: ast::struct_def,
+generics: Generics
struct_def: ast::struct_def,
generics: Generics
) -> @ast::item {
self.item(name, span, ast::item_struct(@struct_def, generics))
}
fn struct_expr(&self, path: @ast::Path,
+fields: ~[ast::field]) -> @ast::expr {
fields: ~[ast::field]) -> @ast::expr {
@ast::expr {
id: self.next_id(),
callee_id: self.next_id(),
@ -339,7 +339,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn variant(&self, name: ident, span: span,
+tys: ~[@ast::Ty]) -> ast::variant {
tys: ~[@ast::Ty]) -> ast::variant {
let args = do tys.map |ty| {
ast::variant_arg { ty: *ty, id: self.next_id() }
};
@ -358,7 +358,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item_mod(&self, name: ident, span: span,
+items: ~[@ast::item]) -> @ast::item {
items: ~[@ast::item]) -> @ast::item {
// XXX: Total hack: import `core::kinds::Owned` to work around a
// parser bug whereby `fn f<T:::kinds::Owned>` doesn't parse.
@ -425,7 +425,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item_ty_poly(&self, name: ident, span: span, ty: @ast::Ty,
+generics: Generics) -> @ast::item {
generics: Generics) -> @ast::item {
self.item(name, span, ast::item_ty(ty, generics))
}

View file

@ -19,13 +19,13 @@ use parse::token;
use core::prelude::*;
pub trait proto_parser {
fn parse_proto(&self, +id: ~str) -> protocol;
fn parse_proto(&self, id: ~str) -> protocol;
fn parse_state(&self, proto: protocol);
fn parse_message(&self, state: state);
}
impl proto_parser for parser::Parser {
fn parse_proto(&self, +id: ~str) -> protocol {
fn parse_proto(&self, id: ~str) -> protocol {
let proto = protocol(id, *self.span);
self.parse_seq_to_before_end(

View file

@ -81,8 +81,8 @@ pub struct state_ {
}
pub impl state_ {
fn add_message(@self, +name: ~str, span: span,
+data: ~[@ast::Ty], +next: Option<next_state>) {
fn add_message(@self, name: ~str, span: span,
data: ~[@ast::Ty], next: Option<next_state>) {
self.messages.push(message(name, span, data, self,
next));
}
@ -119,11 +119,11 @@ pub impl state_ {
pub type protocol = @mut protocol_;
pub fn protocol(+name: ~str, +span: span) -> protocol {
pub fn protocol(name: ~str, span: span) -> protocol {
@mut protocol_(name, span)
}
pub fn protocol_(+name: ~str, span: span) -> protocol_ {
pub fn protocol_(name: ~str, span: span) -> protocol_ {
protocol_ {
name: name,
span: span,
@ -177,10 +177,10 @@ pub impl protocol_ {
pub impl protocol_ {
fn add_state_poly(@mut self,
+name: ~str,
name: ~str,
ident: ast::ident,
dir: direction,
+generics: ast::Generics)
generics: ast::Generics)
-> state {
let messages = @mut ~[];
let states = &*self.states;

View file

@ -419,7 +419,7 @@ fn ids_ext(cx: @ext_ctxt, strs: ~[~str]) -> ~[ast::ident] {
strs.map(|str| cx.parse_sess().interner.intern(@copy *str))
}
fn id_ext(cx: @ext_ctxt, +str: ~str) -> ast::ident {
fn id_ext(cx: @ext_ctxt, str: ~str) -> ast::ident {
cx.parse_sess().interner.intern(@str)
}
@ -734,8 +734,8 @@ fn expand_tts(cx: @ext_ctxt,
fn expand_parse_call(cx: @ext_ctxt,
sp: span,
+parse_method: ~str,
+arg_exprs: ~[@ast::expr],
parse_method: ~str,
arg_exprs: ~[@ast::expr],
tts: &[ast::token_tree]) -> @ast::expr {
let tts_expr = expand_tts(cx, sp, tts);

View file

@ -98,9 +98,9 @@ pub enum matcher_pos_up { /* to break a circularity */
matcher_pos_up(Option<~MatcherPos>)
}
pub fn is_some(&&mpu: matcher_pos_up) -> bool {
match &mpu {
&matcher_pos_up(None) => false,
pub fn is_some(mpu: &matcher_pos_up) -> bool {
match *mpu {
matcher_pos_up(None) => false,
_ => true
}
}
@ -115,9 +115,9 @@ pub struct MatcherPos {
sp_lo: BytePos,
}
pub fn copy_up(&& mpu: matcher_pos_up) -> ~MatcherPos {
match &mpu {
&matcher_pos_up(Some(ref mp)) => copy (*mp),
pub fn copy_up(mpu: &matcher_pos_up) -> ~MatcherPos {
match *mpu {
matcher_pos_up(Some(ref mp)) => copy (*mp),
_ => fail!()
}
}
@ -132,7 +132,7 @@ pub fn count_names(ms: &[matcher]) -> uint {
}
#[allow(non_implicitly_copyable_typarams)]
pub fn initial_matcher_pos(+ms: ~[matcher], +sep: Option<Token>, lo: BytePos)
pub fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos)
-> ~MatcherPos {
let mut match_idx_hi = 0u;
for ms.each |elt| {
@ -220,7 +220,7 @@ pub enum parse_result {
pub fn parse_or_else(
sess: @mut ParseSess,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
rdr: @reader,
ms: ~[matcher]
) -> HashMap<ident, @named_match> {
@ -257,7 +257,7 @@ pub fn parse(
/* at end of sequence */
if idx >= len {
// can't move out of `match`es, so:
if is_some(ei.up) {
if is_some(&ei.up) {
// hack: a matcher sequence is repeating iff it has a
// parent (the top level is just a container)
@ -267,7 +267,7 @@ pub fn parse(
if idx == len {
// pop from the matcher position
let mut new_pos = copy_up(ei.up);
let mut new_pos = copy_up(&ei.up);
// update matches (the MBE "parse tree") by appending
// each tree as a subtree.
@ -394,7 +394,7 @@ pub fn parse(
match ei.elts[ei.idx].node {
match_nonterminal(_, name, idx) => {
ei.matches[idx].push(@matched_nonterminal(
parse_nt(rust_parser, *sess.interner.get(name))));
parse_nt(&rust_parser, *sess.interner.get(name))));
ei.idx += 1u;
}
_ => fail!()
@ -411,7 +411,7 @@ pub fn parse(
}
}
pub fn parse_nt(p: Parser, name: ~str) -> nonterminal {
pub fn parse_nt(p: &Parser, name: ~str) -> nonterminal {
match name {
~"item" => match p.parse_item(~[]) {
Some(i) => token::nt_item(i),

View file

@ -53,7 +53,7 @@ pub struct TtReader {
pub fn new_tt_reader(sp_diag: @span_handler,
itr: @ident_interner,
interp: Option<HashMap<ident,@named_match>>,
+src: ~[ast::token_tree])
src: ~[ast::token_tree])
-> @mut TtReader {
let r = @mut TtReader {
sp_diag: sp_diag,
@ -109,7 +109,7 @@ pub fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader {
fn lookup_cur_matched_by_matched(r: &mut TtReader,
start: @named_match)
-> @named_match {
fn red(+ad: @named_match, idx: &uint) -> @named_match {
fn red(ad: @named_match, idx: &uint) -> @named_match {
match *ad {
matched_nonterminal(_) => {
// end of the line; duplicate henceforth

View file

@ -27,11 +27,11 @@ pub enum OptVec<T> {
Vec(~[T])
}
pub fn with<T>(+t: T) -> OptVec<T> {
pub fn with<T>(t: T) -> OptVec<T> {
Vec(~[t])
}
pub fn from<T>(+t: ~[T]) -> OptVec<T> {
pub fn from<T>(t: ~[T]) -> OptVec<T> {
if t.len() == 0 {
Empty
} else {
@ -40,7 +40,7 @@ pub fn from<T>(+t: ~[T]) -> OptVec<T> {
}
impl<T> OptVec<T> {
fn push(&mut self, +t: T) {
fn push(&mut self, t: T) {
match *self {
Vec(ref mut v) => {
v.push(t);
@ -91,7 +91,7 @@ impl<T> OptVec<T> {
}
}
pub fn take_vec<T>(+v: OptVec<T>) -> ~[T] {
pub fn take_vec<T>(v: OptVec<T>) -> ~[T] {
match v {
Empty => ~[],
Vec(v) => v
@ -99,7 +99,7 @@ pub fn take_vec<T>(+v: OptVec<T>) -> ~[T] {
}
impl<T:Copy> OptVec<T> {
fn prepend(&self, +t: T) -> OptVec<T> {
fn prepend(&self, t: T) -> OptVec<T> {
let mut v0 = ~[t];
match *self {
Empty => {}
@ -157,7 +157,7 @@ impl<A> BaseIter<A> for OptVec<A> {
impl<A> iter::ExtendedIter<A> for OptVec<A> {
#[inline(always)]
fn eachi(&self, blk: &fn(+v: uint, v: &A) -> bool) {
fn eachi(&self, blk: &fn(v: uint, v: &A) -> bool) {
iter::eachi(self, blk)
}
#[inline(always)]
@ -169,7 +169,7 @@ impl<A> iter::ExtendedIter<A> for OptVec<A> {
iter::any(self, blk)
}
#[inline(always)]
fn foldl<B>(&self, +b0: B, blk: &fn(&B, &A) -> B) -> B {
fn foldl<B>(&self, b0: B, blk: &fn(&B, &A) -> B) -> B {
iter::foldl(self, b0, blk)
}
#[inline(always)]

View file

@ -40,7 +40,7 @@ pub fn expr_is_simple_block(e: @ast::expr) -> bool {
}
}
pub fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
pub fn stmt_ends_with_semi(stmt: &ast::stmt) -> bool {
return match stmt.node {
ast::stmt_decl(d, _) => {
match d.node {

View file

@ -319,7 +319,7 @@ pub struct lit {
pub fn gather_comments_and_literals(span_diagnostic:
@diagnostic::span_handler,
+path: ~str,
path: ~str,
srdr: @io::Reader)
-> (~[cmnt], ~[lit]) {
let src = @str::from_bytes(srdr.read_whole_stream());

View file

@ -28,13 +28,13 @@ pub struct SeqSep {
trailing_sep_allowed: bool
}
pub fn seq_sep_trailing_disallowed(+t: token::Token) -> SeqSep {
pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {
SeqSep {
sep: Some(t),
trailing_sep_allowed: false,
}
}
pub fn seq_sep_trailing_allowed(+t: token::Token) -> SeqSep {
pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep {
SeqSep {
sep: Some(t),
trailing_sep_allowed: true,

View file

@ -126,7 +126,7 @@ pub fn parse_crate_from_source_str(
pub fn parse_expr_from_source_str(
name: ~str,
source: @~str,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
sess: @mut ParseSess
) -> @ast::expr {
let p = new_parser_from_source_str(
@ -142,8 +142,8 @@ pub fn parse_expr_from_source_str(
pub fn parse_item_from_source_str(
name: ~str,
source: @~str,
+cfg: ast::crate_cfg,
+attrs: ~[ast::attribute],
cfg: ast::crate_cfg,
attrs: ~[ast::attribute],
sess: @mut ParseSess
) -> Option<@ast::item> {
let p = new_parser_from_source_str(
@ -159,7 +159,7 @@ pub fn parse_item_from_source_str(
pub fn parse_meta_from_source_str(
name: ~str,
source: @~str,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
sess: @mut ParseSess
) -> @ast::meta_item {
let p = new_parser_from_source_str(
@ -175,8 +175,8 @@ pub fn parse_meta_from_source_str(
pub fn parse_stmt_from_source_str(
name: ~str,
source: @~str,
+cfg: ast::crate_cfg,
+attrs: ~[ast::attribute],
cfg: ast::crate_cfg,
attrs: ~[ast::attribute],
sess: @mut ParseSess
) -> @ast::stmt {
let p = new_parser_from_source_str(
@ -192,7 +192,7 @@ pub fn parse_stmt_from_source_str(
pub fn parse_tts_from_source_str(
name: ~str,
source: @~str,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
sess: @mut ParseSess
) -> ~[ast::token_tree] {
let p = new_parser_from_source_str(
@ -207,20 +207,20 @@ pub fn parse_tts_from_source_str(
}
pub fn parse_from_source_str<T>(
f: &fn (Parser) -> T,
f: &fn(&Parser) -> T,
name: ~str, ss: codemap::FileSubstr,
source: @~str,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
sess: @mut ParseSess
) -> T {
let p = new_parser_from_source_str(
sess,
cfg,
/*bad*/ copy name,
/*bad*/ copy ss,
name,
ss,
source
);
let r = f(p);
let r = f(&p);
if !p.reader.is_eof() {
p.reader.fatal(~"expected end-of-string");
}
@ -236,9 +236,9 @@ pub fn next_node_id(sess: @mut ParseSess) -> node_id {
}
pub fn new_parser_from_source_str(sess: @mut ParseSess,
+cfg: ast::crate_cfg,
+name: ~str,
+ss: codemap::FileSubstr,
cfg: ast::crate_cfg,
name: ~str,
ss: codemap::FileSubstr,
source: @~str)
-> Parser {
let filemap = sess.cm.new_filemap_w_substr(name, ss, source);
@ -254,7 +254,7 @@ pub fn new_parser_from_source_str(sess: @mut ParseSess,
/// that draws from that string
pub fn new_parser_result_from_file(
sess: @mut ParseSess,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
path: &Path
) -> Result<Parser, ~str> {
match io::read_whole_file_str(path) {
@ -274,7 +274,7 @@ pub fn new_parser_result_from_file(
/// if the file doesn't exist
pub fn new_parser_from_file(
sess: @mut ParseSess,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
path: &Path
) -> Parser {
match new_parser_result_from_file(sess, cfg, path) {
@ -289,7 +289,7 @@ pub fn new_parser_from_file(
/// error messages correctly when the file does not exist.
pub fn new_sub_parser_from_file(
sess: @mut ParseSess,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
path: &Path,
sp: span
) -> Parser {
@ -303,8 +303,8 @@ pub fn new_sub_parser_from_file(
pub fn new_parser_from_tts(
sess: @mut ParseSess,
+cfg: ast::crate_cfg,
+tts: ~[ast::token_tree]
cfg: ast::crate_cfg,
tts: ~[ast::token_tree]
) -> Parser {
let trdr = lexer::new_tt_reader(
copy sess.span_diagnostic,
@ -316,7 +316,7 @@ pub fn new_parser_from_tts(
}
// abort if necessary
pub fn maybe_aborted<T>(+result : T, p: Parser) -> T {
pub fn maybe_aborted<T>(result : T, p: Parser) -> T {
p.abort_if_errors();
result
}

View file

@ -66,7 +66,7 @@ pub enum ObsoleteSyntax {
impl to_bytes::IterBytes for ObsoleteSyntax {
#[inline(always)]
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as uint).iter_bytes(lsb0, f);
}
}

View file

@ -201,7 +201,7 @@ macro_rules! maybe_whole (
)
fn maybe_append(+lhs: ~[attribute], rhs: Option<~[attribute]>)
fn maybe_append(lhs: ~[attribute], rhs: Option<~[attribute]>)
-> ~[attribute] {
match rhs {
None => lhs,
@ -220,8 +220,8 @@ struct ParsedItemsAndViewItems {
/* ident is handled by common.rs */
pub fn Parser(sess: @mut ParseSess,
+cfg: ast::crate_cfg,
+rdr: @reader)
cfg: ast::crate_cfg,
rdr: @reader)
-> Parser {
let tok0 = copy rdr.next_token();
let interner = rdr.interner();
@ -299,7 +299,7 @@ pub impl Parser {
*self.tokens_consumed += 1u;
}
// EFFECT: replace the current token and span with the given one
fn replace_token(&self, +next: token::Token, +lo: BytePos, +hi: BytePos) {
fn replace_token(&self, next: token::Token, lo: BytePos, hi: BytePos) {
*self.token = next;
*self.span = mk_sp(lo, hi);
}
@ -713,7 +713,7 @@ pub impl Parser {
fn parse_box_or_uniq_pointee(
&self,
sigil: ast::Sigil,
ctor: &fn(+v: mt) -> ty_) -> ty_
ctor: &fn(v: mt) -> ty_) -> ty_
{
// @'foo fn() or @foo/fn() or @fn() are parsed directly as fn types:
match *self.token {
@ -1112,7 +1112,7 @@ pub impl Parser {
spanned(lo, e.span.hi, ast::field_ { mutbl: m, ident: i, expr: e })
}
fn mk_expr(&self, +lo: BytePos, +hi: BytePos, +node: expr_) -> @expr {
fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
@expr {
id: self.get_id(),
callee_id: self.get_id(),
@ -1121,7 +1121,7 @@ pub impl Parser {
}
}
fn mk_mac_expr(&self, +lo: BytePos, +hi: BytePos, +m: mac_) -> @expr {
fn mk_mac_expr(&self, lo: BytePos, hi: BytePos, m: mac_) -> @expr {
@expr {
id: self.get_id(),
callee_id: self.get_id(),
@ -1897,7 +1897,7 @@ pub impl Parser {
fn parse_sugary_call_expr(&self, keyword: ~str,
sugar: CallSugar,
ctor: &fn(+v: @expr) -> expr_) -> @expr {
ctor: &fn(v: @expr) -> expr_) -> @expr {
let lo = self.last_span;
// Parse the callee `foo` in
// for foo || {
@ -2472,7 +2472,7 @@ pub impl Parser {
})
}
fn parse_stmt(&self, +first_item_attrs: ~[attribute]) -> @stmt {
fn parse_stmt(&self, first_item_attrs: ~[attribute]) -> @stmt {
maybe_whole!(self, nt_stmt);
fn check_expected_item(p: &Parser, current_attrs: &[attribute]) {
@ -2612,7 +2612,7 @@ pub impl Parser {
// parse the rest of a block expression or function body
fn parse_block_tail_(&self, lo: BytePos, s: blk_check_mode,
+first_item_attrs: ~[attribute]) -> blk {
first_item_attrs: ~[attribute]) -> blk {
let mut stmts = ~[];
let mut expr = None;
@ -2658,7 +2658,7 @@ pub impl Parser {
expr = Some(e);
}
copy t => {
if classify::stmt_ends_with_semi(*stmt) {
if classify::stmt_ends_with_semi(stmt) {
self.fatal(
fmt!(
"expected `;` or `}` after \
@ -2696,7 +2696,7 @@ pub impl Parser {
_ => { // All other kinds of statements:
stmts.push(stmt);
if classify::stmt_ends_with_semi(*stmt) {
if classify::stmt_ends_with_semi(stmt) {
self.expect(&token::SEMI);
}
}
@ -2891,7 +2891,7 @@ pub impl Parser {
&fn(&Parser) -> arg_or_capture_item
) -> (self_ty, fn_decl) {
fn maybe_parse_self_ty(
cnstr: &fn(+v: mutability) -> ast::self_ty_,
cnstr: &fn(v: mutability) -> ast::self_ty_,
p: &Parser
) -> ast::self_ty_ {
// We need to make sure it isn't a mode or a type
@ -3064,9 +3064,9 @@ pub impl Parser {
(id, generics)
}
fn mk_item(&self, +lo: BytePos, +hi: BytePos, +ident: ident,
+node: item_, vis: visibility,
+attrs: ~[attribute]) -> @item {
fn mk_item(&self, lo: BytePos, hi: BytePos, ident: ident,
node: item_, vis: visibility,
attrs: ~[attribute]) -> @item {
@ast::item { ident: ident,
attrs: attrs,
id: self.get_id(),
@ -3305,7 +3305,7 @@ pub impl Parser {
None)
}
fn token_is_pound_or_doc_comment(&self, ++tok: token::Token) -> bool {
fn token_is_pound_or_doc_comment(&self, tok: token::Token) -> bool {
match tok {
token::POUND | token::DOC_COMMENT(_) => true,
_ => false
@ -3340,7 +3340,7 @@ pub impl Parser {
a_var
}
fn parse_dtor(&self, +attrs: ~[attribute]) -> class_contents {
fn parse_dtor(&self, attrs: ~[attribute]) -> class_contents {
let lo = self.last_span.lo;
let body = self.parse_block();
dtor_decl(body, attrs, mk_sp(lo, self.last_span.hi))
@ -3392,7 +3392,7 @@ pub impl Parser {
// given a termination token and a vector of already-parsed
// attributes (of length 0 or 1), parse all of the items in a module
fn parse_mod_items(&self, term: token::Token,
+first_item_attrs: ~[attribute]) -> _mod {
first_item_attrs: ~[attribute]) -> _mod {
// parse all of the items up to closing or an attribute.
// view items are legal here.
let ParsedItemsAndViewItems {
@ -3553,7 +3553,7 @@ pub impl Parser {
outer_attrs, id_sp)
}
fn eval_src_mod_from_path(&self, prefix: Path, +path: Path,
fn eval_src_mod_from_path(&self, prefix: Path, path: Path,
outer_attrs: ~[ast::attribute],
id_sp: span
) -> (ast::item_, ~[ast::attribute]) {
@ -3576,7 +3576,7 @@ pub impl Parser {
let m0 = p0.parse_mod_items(token::EOF, first_item_outer_attrs);
return (ast::item_mod(m0), mod_attrs);
fn cdir_path_opt(+default: ~str, attrs: ~[ast::attribute]) -> ~str {
fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str {
match ::attr::first_attr_value_str_by_name(attrs, ~"path") {
Some(d) => copy *d,
None => default
@ -3584,7 +3584,7 @@ pub impl Parser {
}
}
fn parse_item_foreign_fn(&self, +attrs: ~[attribute]) -> @foreign_item {
fn parse_item_foreign_fn(&self, attrs: ~[attribute]) -> @foreign_item {
let lo = self.span.lo;
let vis = self.parse_visibility();
let purity = self.parse_fn_purity();
@ -3601,7 +3601,7 @@ pub impl Parser {
}
fn parse_item_foreign_const(&self, vis: ast::visibility,
+attrs: ~[attribute]) -> @foreign_item {
attrs: ~[attribute]) -> @foreign_item {
let lo = self.span.lo;
// XXX: Obsolete; remove after snap.
@ -3638,7 +3638,7 @@ pub impl Parser {
else { self.unexpected(); }
}
fn parse_foreign_item(&self, +attrs: ~[attribute]) -> @foreign_item {
fn parse_foreign_item(&self, attrs: ~[attribute]) -> @foreign_item {
let vis = self.parse_visibility();
if self.is_keyword(&~"const") || self.is_keyword(&~"static") {
self.parse_item_foreign_const(vis, attrs)
@ -3648,8 +3648,8 @@ pub impl Parser {
}
fn parse_foreign_mod_items(&self, sort: ast::foreign_mod_sort,
+abis: AbiSet,
+first_item_attrs: ~[attribute])
abis: AbiSet,
first_item_attrs: ~[attribute])
-> foreign_mod {
// Shouldn't be any view items since we've already parsed an item attr
let ParsedItemsAndViewItems {
@ -3987,7 +3987,7 @@ pub impl Parser {
// flags; on failure, return iovi_none.
fn parse_item_or_view_item(
&self,
+attrs: ~[attribute],
attrs: ~[attribute],
items_allowed: bool,
foreign_items_allowed: bool,
macros_allowed: bool
@ -4198,7 +4198,7 @@ pub impl Parser {
return iovi_none;
}
fn parse_item(&self, +attrs: ~[attribute]) -> Option<@ast::item> {
fn parse_item(&self, attrs: ~[attribute]) -> Option<@ast::item> {
match self.parse_item_or_view_item(attrs, true, false, true) {
iovi_none =>
None,
@ -4337,7 +4337,7 @@ pub impl Parser {
// parse a view item.
fn parse_view_item(
&self,
+attrs: ~[attribute],
attrs: ~[attribute],
vis: visibility
) -> @view_item {
let lo = self.span.lo;
@ -4363,7 +4363,7 @@ pub impl Parser {
// - mod_items uses VIEW_ITEMS_AND_ITEMS_ALLOWED
// - block_tail_ uses IMPORTS_AND_ITEMS_ALLOWED
// - foreign_mod_items uses FOREIGN_ITEMS_ALLOWED
fn parse_items_and_view_items(&self, +first_item_attrs: ~[attribute],
fn parse_items_and_view_items(&self, first_item_attrs: ~[attribute],
mode: view_item_parse_mode,
macros_allowed: bool)
-> ParsedItemsAndViewItems {

View file

@ -104,7 +104,7 @@ pub impl token {
}
}
pub fn tok_str(++t: token) -> ~str {
pub fn tok_str(t: token) -> ~str {
match t {
STRING(s, len) => return fmt!("STR(%s,%d)", *s, len),
BREAK(_) => return ~"BREAK",
@ -398,7 +398,7 @@ pub impl Printer {
self.right %= self.buf_len;
assert!((self.right != self.left));
}
fn advance_left(&mut self, ++x: token, L: int) {
fn advance_left(&mut self, x: token, L: int) {
debug!("advnce_left ~[%u,%u], sizeof(%u)=%d", self.left, self.right,
self.left, L);
if L >= 0 {

View file

@ -134,7 +134,7 @@ pub fn print_crate(cm: @CodeMap,
print_crate_(s, crate);
}
pub fn print_crate_(s: @ps, &&crate: @ast::crate) {
pub fn print_crate_(s: @ps, crate: @ast::crate) {
print_mod(s, &crate.node.module, crate.node.attrs);
print_remaining_comments(s);
eof(s.s);
@ -164,7 +164,7 @@ pub fn tts_to_str(tts: &[ast::token_tree], intr: @ident_interner) -> ~str {
to_str(tts, print_tts, intr)
}
pub fn stmt_to_str(s: ast::stmt, intr: @ident_interner) -> ~str {
pub fn stmt_to_str(s: &ast::stmt, intr: @ident_interner) -> ~str {
to_str(s, print_stmt, intr)
}
@ -177,7 +177,7 @@ pub fn generics_to_str(generics: &ast::Generics,
to_str(generics, print_generics, intr)
}
pub fn path_to_str(&&p: @ast::Path, intr: @ident_interner) -> ~str {
pub fn path_to_str(p: @ast::Path, intr: @ident_interner) -> ~str {
to_str(p, |a,b| print_path(a, b, false), intr)
}
@ -312,7 +312,7 @@ pub fn synth_comment(s: @ps, text: ~str) {
word(s.s, ~"*/");
}
pub fn commasep<IN>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN)) {
pub fn commasep<IN: Copy>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN)) {
box(s, 0u, b);
let mut first = true;
for elts.each |elt| {
@ -323,8 +323,8 @@ pub fn commasep<IN>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN)) {
}
pub fn commasep_cmnt<IN>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN),
get_span: &fn(IN) -> codemap::span) {
pub fn commasep_cmnt<IN: Copy>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN),
get_span: &fn(IN) -> codemap::span) {
box(s, 0u, b);
let len = elts.len();
let mut i = 0u;
@ -343,7 +343,7 @@ pub fn commasep_cmnt<IN>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN),
}
pub fn commasep_exprs(s: @ps, b: breaks, exprs: &[@ast::expr]) {
fn expr_span(&&expr: @ast::expr) -> codemap::span { return expr.span; }
fn expr_span(expr: @ast::expr) -> codemap::span { return expr.span; }
commasep_cmnt(s, b, exprs, print_expr, expr_span);
}
@ -371,7 +371,7 @@ pub fn print_opt_lifetime(s: @ps, lifetime: Option<@ast::Lifetime>) {
}
}
pub fn print_type(s: @ps, &&ty: @ast::Ty) {
pub fn print_type(s: @ps, ty: @ast::Ty) {
maybe_print_comment(s, ty.span.lo);
ibox(s, 0u);
match ty.node {
@ -465,7 +465,7 @@ pub fn print_foreign_item(s: @ps, item: @ast::foreign_item) {
}
}
pub fn print_item(s: @ps, &&item: @ast::item) {
pub fn print_item(s: @ps, item: @ast::item) {
hardbreak_if_not_bol(s);
maybe_print_comment(s, item.span.lo);
print_outer_attributes(s, item.attrs);
@ -760,7 +760,7 @@ pub fn print_tt(s: @ps, tt: ast::token_tree) {
}
}
pub fn print_tts(s: @ps, &&tts: &[ast::token_tree]) {
pub fn print_tts(s: @ps, tts: &[ast::token_tree]) {
ibox(s, 0);
for tts.eachi |i, tt| {
if i != 0 {
@ -872,7 +872,7 @@ pub fn print_attribute(s: @ps, attr: ast::attribute) {
}
pub fn print_stmt(s: @ps, st: ast::stmt) {
pub fn print_stmt(s: @ps, st: &ast::stmt) {
maybe_print_comment(s, st.span.lo);
match st.node {
ast::stmt_decl(decl, _) => {
@ -950,7 +950,7 @@ pub fn print_possibly_embedded_block_(s: @ps,
for blk.node.view_items.each |vi| { print_view_item(s, *vi); }
for blk.node.stmts.each |st| {
print_stmt(s, **st);
print_stmt(s, *st);
}
match blk.node.expr {
Some(expr) => {
@ -1089,7 +1089,7 @@ pub fn print_call_post(s: @ps,
}
}
pub fn print_expr(s: @ps, &&expr: @ast::expr) {
pub fn print_expr(s: @ps, expr: @ast::expr) {
fn print_field(s: @ps, field: ast::field) {
ibox(s, indent_unit);
if field.node.mutbl == ast::m_mutbl { word_nbsp(s, ~"mut"); }
@ -1454,7 +1454,7 @@ pub fn print_decl(s: @ps, decl: @ast::decl) {
word_nbsp(s, ~"mut");
}
fn print_local(s: @ps, &&loc: @ast::local) {
fn print_local(s: @ps, loc: @ast::local) {
ibox(s, indent_unit);
print_local_decl(s, loc);
end(s);
@ -1485,7 +1485,7 @@ pub fn print_for_decl(s: @ps, loc: @ast::local, coll: @ast::expr) {
print_expr(s, coll);
}
pub fn print_path(s: @ps, &&path: @ast::Path, colons_before_params: bool) {
pub fn print_path(s: @ps, path: @ast::Path, colons_before_params: bool) {
maybe_print_comment(s, path.span.lo);
if path.global { word(s.s, ~"::"); }
let mut first = true;
@ -1513,15 +1513,15 @@ pub fn print_path(s: @ps, &&path: @ast::Path, colons_before_params: bool) {
}
}
pub fn print_irrefutable_pat(s: @ps, &&pat: @ast::pat) {
pub fn print_irrefutable_pat(s: @ps, pat: @ast::pat) {
print_pat(s, pat, false)
}
pub fn print_refutable_pat(s: @ps, &&pat: @ast::pat) {
pub fn print_refutable_pat(s: @ps, pat: @ast::pat) {
print_pat(s, pat, true)
}
pub fn print_pat(s: @ps, &&pat: @ast::pat, refutable: bool) {
pub fn print_pat(s: @ps, pat: @ast::pat, refutable: bool) {
maybe_print_comment(s, pat.span.lo);
let ann_node = node_pat(s, pat);
(s.ann.pre)(ann_node);
@ -1758,12 +1758,12 @@ pub fn print_bounds(s: @ps, bounds: @OptVec<ast::TyParamBound>) {
}
}
pub fn print_lifetime(s: @ps, &&lifetime: &ast::Lifetime) {
pub fn print_lifetime(s: @ps, lifetime: &ast::Lifetime) {
word(s.s, ~"'");
print_ident(s, lifetime.ident);
}
pub fn print_generics(s: @ps, &&generics: &ast::Generics) {
pub fn print_generics(s: @ps, generics: &ast::Generics) {
let total = generics.lifetimes.len() + generics.ty_params.len();
if total > 0 {
word(s.s, ~"<");
@ -1790,7 +1790,7 @@ pub fn print_generics(s: @ps, &&generics: &ast::Generics) {
}
}
pub fn print_meta_item(s: @ps, &&item: @ast::meta_item) {
pub fn print_meta_item(s: @ps, item: @ast::meta_item) {
ibox(s, indent_unit);
match item.node {
ast::meta_word(name) => word(s.s, *name),
@ -1814,7 +1814,7 @@ pub fn print_meta_item(s: @ps, &&item: @ast::meta_item) {
end(s);
}
pub fn print_view_path(s: @ps, &&vp: @ast::view_path) {
pub fn print_view_path(s: @ps, vp: @ast::view_path) {
match vp.node {
ast::view_path_simple(ident, path, namespace, _) => {
if namespace == ast::module_ns {
@ -2006,7 +2006,7 @@ pub fn print_remaining_comments(s: @ps) {
}
}
pub fn print_literal(s: @ps, &&lit: @ast::lit) {
pub fn print_literal(s: @ps, lit: @ast::lit) {
maybe_print_comment(s, lit.span.lo);
match next_lit(s, lit.span.lo) {
Some(ref ltrl) => {
@ -2137,7 +2137,7 @@ pub fn print_string(s: @ps, st: &str) {
word(s.s, ~"\"");
}
pub fn to_str<T>(t: T, f: @fn(@ps, T), intr: @ident_interner) -> ~str {
pub fn to_str<T: Copy>(t: T, f: @fn(@ps, T), intr: @ident_interner) -> ~str {
do io::with_str_writer |wr| {
let s = rust_printer(wr, intr);
f(s, t);

View file

@ -17,11 +17,10 @@
#[license = "MIT/ASL2"];
#[crate_type = "lib"];
#[legacy_modes];
#[allow(vecs_implicitly_copyable)];
#[allow(non_camel_case_types)];
#[allow(deprecated_mode)];
#[deny(deprecated_mode)];
#[deny(deprecated_pattern)];
#[no_core];

View file

@ -101,7 +101,7 @@ pub struct Visitor<E> {
pub type visitor<E> = @Visitor<E>;
pub fn default_visitor<E>() -> visitor<E> {
pub fn default_visitor<E: Copy>() -> visitor<E> {
return @Visitor {
visit_mod: |a,b,c,d,e|visit_mod::<E>(a, b, c, d, e),
visit_view_item: |a,b,c|visit_view_item::<E>(a, b, c),
@ -127,18 +127,18 @@ pub fn default_visitor<E>() -> visitor<E> {
};
}
pub fn visit_crate<E>(c: crate, e: E, v: vt<E>) {
pub fn visit_crate<E: Copy>(c: &crate, e: E, v: vt<E>) {
(v.visit_mod)(&c.node.module, c.span, crate_node_id, e, v);
}
pub fn visit_mod<E>(m: &_mod, _sp: span, _id: node_id, e: E, v: vt<E>) {
pub fn visit_mod<E: Copy>(m: &_mod, _sp: span, _id: node_id, e: E, v: vt<E>) {
for m.view_items.each |vi| { (v.visit_view_item)(*vi, e, v); }
for m.items.each |i| { (v.visit_item)(*i, e, v); }
}
pub fn visit_view_item<E>(_vi: @view_item, _e: E, _v: vt<E>) { }
pub fn visit_local<E>(loc: @local, e: E, v: vt<E>) {
pub fn visit_local<E: Copy>(loc: @local, e: E, v: vt<E>) {
(v.visit_pat)(loc.node.pat, e, v);
(v.visit_ty)(loc.node.ty, e, v);
match loc.node.init {
@ -147,11 +147,11 @@ pub fn visit_local<E>(loc: @local, e: E, v: vt<E>) {
}
}
fn visit_trait_ref<E>(tref: @ast::trait_ref, e: E, v: vt<E>) {
fn visit_trait_ref<E: Copy>(tref: @ast::trait_ref, e: E, v: vt<E>) {
visit_path(tref.path, e, v);
}
pub fn visit_item<E>(i: @item, e: E, v: vt<E>) {
pub fn visit_item<E: Copy>(i: @item, e: E, v: vt<E>) {
match i.node {
item_const(t, ex) => {
(v.visit_ty)(t, e, v);
@ -216,10 +216,10 @@ pub fn visit_item<E>(i: @item, e: E, v: vt<E>) {
}
}
pub fn visit_enum_def<E>(enum_definition: ast::enum_def,
tps: &Generics,
e: E,
v: vt<E>) {
pub fn visit_enum_def<E: Copy>(enum_definition: ast::enum_def,
tps: &Generics,
e: E,
v: vt<E>) {
for enum_definition.variants.each |vr| {
match vr.node.kind {
tuple_variant_kind(ref variant_args) => {
@ -237,7 +237,7 @@ pub fn visit_enum_def<E>(enum_definition: ast::enum_def,
pub fn skip_ty<E>(_t: @Ty, _e: E, _v: vt<E>) {}
pub fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
pub fn visit_ty<E: Copy>(t: @Ty, e: E, v: vt<E>) {
match t.node {
ty_box(mt) | ty_uniq(mt) |
ty_vec(mt) | ty_ptr(mt) | ty_rptr(_, mt) => {
@ -265,11 +265,11 @@ pub fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
}
}
pub fn visit_path<E>(p: @Path, e: E, v: vt<E>) {
pub fn visit_path<E: Copy>(p: @Path, e: E, v: vt<E>) {
for p.types.each |tp| { (v.visit_ty)(*tp, e, v); }
}
pub fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
pub fn visit_pat<E: Copy>(p: @pat, e: E, v: vt<E>) {
match p.node {
pat_enum(path, ref children) => {
visit_path(path, e, v);
@ -315,7 +315,7 @@ pub fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
}
}
pub fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
pub fn visit_foreign_item<E: Copy>(ni: @foreign_item, e: E, v: vt<E>) {
match ni.node {
foreign_item_fn(ref fd, _, ref generics) => {
visit_fn_decl(fd, e, v);
@ -327,8 +327,8 @@ pub fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
}
}
pub fn visit_ty_param_bounds<E>(bounds: @OptVec<TyParamBound>,
e: E, v: vt<E>) {
pub fn visit_ty_param_bounds<E: Copy>(bounds: @OptVec<TyParamBound>,
e: E, v: vt<E>) {
for bounds.each |bound| {
match *bound {
TraitTyParamBound(ty) => visit_trait_ref(ty, e, v),
@ -337,13 +337,13 @@ pub fn visit_ty_param_bounds<E>(bounds: @OptVec<TyParamBound>,
}
}
pub fn visit_generics<E>(generics: &Generics, e: E, v: vt<E>) {
pub fn visit_generics<E: Copy>(generics: &Generics, e: E, v: vt<E>) {
for generics.ty_params.each |tp| {
visit_ty_param_bounds(tp.bounds, e, v);
}
}
pub fn visit_fn_decl<E>(fd: &fn_decl, e: E, v: vt<E>) {
pub fn visit_fn_decl<E: Copy>(fd: &fn_decl, e: E, v: vt<E>) {
for fd.inputs.each |a| {
(v.visit_pat)(a.pat, e, v);
(v.visit_ty)(a.ty, e, v);
@ -355,7 +355,7 @@ pub fn visit_fn_decl<E>(fd: &fn_decl, e: E, v: vt<E>) {
// visit_fn() and check for fk_method(). I named this visit_method_helper()
// because it is not a default impl of any method, though I doubt that really
// clarifies anything. - Niko
pub fn visit_method_helper<E>(m: &method, e: E, v: vt<E>) {
pub fn visit_method_helper<E: Copy>(m: &method, e: E, v: vt<E>) {
(v.visit_fn)(
&fk_method(
/* FIXME (#2543) */ copy m.ident,
@ -390,28 +390,28 @@ pub fn visit_struct_dtor_helper<E>(dtor: struct_dtor, generics: &Generics,
}
pub fn visit_fn<E>(fk: &fn_kind, decl: &fn_decl, body: &blk, _sp: span,
_id: node_id, e: E, v: vt<E>) {
pub fn visit_fn<E: Copy>(fk: &fn_kind, decl: &fn_decl, body: &blk, _sp: span,
_id: node_id, e: E, v: vt<E>) {
visit_fn_decl(decl, e, v);
let generics = generics_of_fn(fk);
(v.visit_generics)(&generics, e, v);
(v.visit_block)(body, e, v);
}
pub fn visit_ty_method<E>(m: &ty_method, e: E, v: vt<E>) {
pub fn visit_ty_method<E: Copy>(m: &ty_method, e: E, v: vt<E>) {
for m.decl.inputs.each |a| { (v.visit_ty)(a.ty, e, v); }
(v.visit_generics)(&m.generics, e, v);
(v.visit_ty)(m.decl.output, e, v);
}
pub fn visit_trait_method<E>(m: &trait_method, e: E, v: vt<E>) {
pub fn visit_trait_method<E: Copy>(m: &trait_method, e: E, v: vt<E>) {
match *m {
required(ref ty_m) => (v.visit_ty_method)(ty_m, e, v),
provided(m) => visit_method_helper(m, e, v)
}
}
pub fn visit_struct_def<E>(
pub fn visit_struct_def<E: Copy>(
sd: @struct_def,
_nm: ast::ident,
generics: &Generics,
@ -433,15 +433,15 @@ pub fn visit_struct_def<E>(
}
}
pub fn visit_struct_field<E>(sf: @struct_field, e: E, v: vt<E>) {
pub fn visit_struct_field<E: Copy>(sf: @struct_field, e: E, v: vt<E>) {
(v.visit_ty)(sf.node.ty, e, v);
}
pub fn visit_struct_method<E>(m: @method, e: E, v: vt<E>) {
pub fn visit_struct_method<E: Copy>(m: @method, e: E, v: vt<E>) {
visit_method_helper(m, e, v);
}
pub fn visit_block<E>(b: &blk, e: E, v: vt<E>) {
pub fn visit_block<E: Copy>(b: &blk, e: E, v: vt<E>) {
for b.node.view_items.each |vi| {
(v.visit_view_item)(*vi, e, v);
}
@ -460,7 +460,7 @@ pub fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
}
}
pub fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
pub fn visit_decl<E: Copy>(d: @decl, e: E, v: vt<E>) {
match d.node {
decl_local(ref locs) => {
for locs.each |loc| {
@ -475,7 +475,7 @@ pub fn visit_expr_opt<E>(eo: Option<@expr>, e: E, v: vt<E>) {
match eo { None => (), Some(ex) => (v.visit_expr)(ex, e, v) }
}
pub fn visit_exprs<E>(exprs: &[@expr], e: E, v: vt<E>) {
pub fn visit_exprs<E: Copy>(exprs: &[@expr], e: E, v: vt<E>) {
for exprs.each |ex| { (v.visit_expr)(*ex, e, v); }
}
@ -483,7 +483,7 @@ pub fn visit_mac<E>(_m: mac, _e: E, _v: vt<E>) {
/* no user-serviceable parts inside */
}
pub fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
pub fn visit_expr<E: Copy>(ex: @expr, e: E, v: vt<E>) {
match ex.node {
expr_vstore(x, _) => (v.visit_expr)(x, e, v),
expr_vec(ref es, _) => visit_exprs(*es, e, v),
@ -588,7 +588,7 @@ pub fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
(v.visit_expr_post)(ex, e, v);
}
pub fn visit_arm<E>(a: &arm, e: E, v: vt<E>) {
pub fn visit_arm<E: Copy>(a: &arm, e: E, v: vt<E>) {
for a.pats.each |p| { (v.visit_pat)(*p, e, v); }
visit_expr_opt(a.guard, e, v);
(v.visit_block)(&a.body, e, v);
@ -655,67 +655,67 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
m: &_mod,
sp: span,
id: node_id,
&&e: (),
e: (),
v: vt<()>
) {
f(m, sp, id);
visit_mod(m, sp, id, e, v);
}
fn v_view_item(f: @fn(@view_item), vi: @view_item, &&e: (), v: vt<()>) {
fn v_view_item(f: @fn(@view_item), vi: @view_item, e: (), v: vt<()>) {
f(vi);
visit_view_item(vi, e, v);
}
fn v_foreign_item(f: @fn(@foreign_item), ni: @foreign_item, &&e: (),
fn v_foreign_item(f: @fn(@foreign_item), ni: @foreign_item, e: (),
v: vt<()>) {
f(ni);
visit_foreign_item(ni, e, v);
}
fn v_item(f: @fn(@item), i: @item, &&e: (), v: vt<()>) {
fn v_item(f: @fn(@item), i: @item, e: (), v: vt<()>) {
f(i);
visit_item(i, e, v);
}
fn v_local(f: @fn(@local), l: @local, &&e: (), v: vt<()>) {
fn v_local(f: @fn(@local), l: @local, e: (), v: vt<()>) {
f(l);
visit_local(l, e, v);
}
fn v_block(f: @fn(&ast::blk), bl: &ast::blk, &&e: (), v: vt<()>) {
fn v_block(f: @fn(&ast::blk), bl: &ast::blk, e: (), v: vt<()>) {
f(bl);
visit_block(bl, e, v);
}
fn v_stmt(f: @fn(@stmt), st: @stmt, &&e: (), v: vt<()>) {
fn v_stmt(f: @fn(@stmt), st: @stmt, e: (), v: vt<()>) {
f(st);
visit_stmt(st, e, v);
}
fn v_arm(f: @fn(&arm), a: &arm, &&e: (), v: vt<()>) {
fn v_arm(f: @fn(&arm), a: &arm, e: (), v: vt<()>) {
f(a);
visit_arm(a, e, v);
}
fn v_pat(f: @fn(@pat), p: @pat, &&e: (), v: vt<()>) {
fn v_pat(f: @fn(@pat), p: @pat, e: (), v: vt<()>) {
f(p);
visit_pat(p, e, v);
}
fn v_decl(f: @fn(@decl), d: @decl, &&e: (), v: vt<()>) {
fn v_decl(f: @fn(@decl), d: @decl, e: (), v: vt<()>) {
f(d);
visit_decl(d, e, v);
}
fn v_expr(f: @fn(@expr), ex: @expr, &&e: (), v: vt<()>) {
fn v_expr(f: @fn(@expr), ex: @expr, e: (), v: vt<()>) {
f(ex);
visit_expr(ex, e, v);
}
fn v_expr_post(f: @fn(@expr), ex: @expr, &&_e: (), _v: vt<()>) {
fn v_expr_post(f: @fn(@expr), ex: @expr, _e: (), _v: vt<()>) {
f(ex);
}
fn v_ty(f: @fn(@Ty), ty: @Ty, &&e: (), v: vt<()>) {
fn v_ty(f: @fn(@Ty), ty: @Ty, e: (), v: vt<()>) {
f(ty);
visit_ty(ty, e, v);
}
fn v_ty_method(f: @fn(&ty_method), ty: &ty_method, &&e: (), v: vt<()>) {
fn v_ty_method(f: @fn(&ty_method), ty: &ty_method, e: (), v: vt<()>) {
f(ty);
visit_ty_method(ty, e, v);
}
fn v_trait_method(f: @fn(&trait_method),
m: &trait_method,
&&e: (),
e: (),
v: vt<()>) {
f(m);
visit_trait_method(m, e, v);
@ -726,7 +726,7 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
nm: ident,
generics: &Generics,
id: node_id,
&&e: (),
e: (),
v: vt<()>
) {
f(sd, nm, generics, id);
@ -735,7 +735,7 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
fn v_generics(
f: @fn(&Generics),
ps: &Generics,
&&e: (),
e: (),
v: vt<()>
) {
f(ps);
@ -748,20 +748,20 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
body: &blk,
sp: span,
id: node_id,
&&e: (),
e: (),
v: vt<()>
) {
f(fk, decl, body, sp, id);
visit_fn(fk, decl, body, sp, id, e, v);
}
let visit_ty: @fn(@Ty, &&x: (), vt<()>) =
let visit_ty: @fn(@Ty, x: (), vt<()>) =
|a,b,c| v_ty(v.visit_ty, a, b, c);
fn v_struct_field(f: @fn(@struct_field), sf: @struct_field, &&e: (),
fn v_struct_field(f: @fn(@struct_field), sf: @struct_field, e: (),
v: vt<()>) {
f(sf);
visit_struct_field(sf, e, v);
}
fn v_struct_method(f: @fn(@method), m: @method, &&e: (), v: vt<()>) {
fn v_struct_method(f: @fn(@method), m: @method, e: (), v: vt<()>) {
f(m);
visit_struct_method(m, e, v);
}