diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-09-04 13:29:32 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-09-04 15:47:04 -0700 |
| commit | 200959d7cef647b34e1d7cf7f4ed2c28b65fc7dc (patch) | |
| tree | d2a2e790b95f73e30320d1e49b0566423ecb17a1 /src/libsyntax | |
| parent | ef880f22450c4f7e455f431ff4603f90d443b545 (diff) | |
| download | rust-200959d7cef647b34e1d7cf7f4ed2c28b65fc7dc.tar.gz rust-200959d7cef647b34e1d7cf7f4ed2c28b65fc7dc.zip | |
Remove 'with'
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_serialize.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/qquote.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/simplext.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 24 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 30 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 3 |
9 files changed, 46 insertions, 61 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 5245494449a..4ea7156116b 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -96,8 +96,8 @@ fn mk_ast_map_visitor() -> vt { visit_local: map_local, visit_arm: map_arm, visit_view_item: map_view_item, - visit_block: map_block - with *visit::default_visitor() + visit_block: map_block, + .. *visit::default_visitor() }); } diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs index bed082e03d4..cd26dc58e73 100644 --- a/src/libsyntax/ext/auto_serialize.rs +++ b/src/libsyntax/ext/auto_serialize.rs @@ -96,8 +96,8 @@ fn expand(cx: ext_ctxt, } fn filter_attrs(item: @ast::item) -> @ast::item { - @{attrs: vec::filter(item.attrs, not_auto_serialize) - with *item} + @{attrs: vec::filter(item.attrs, not_auto_serialize), + .. *item} } do vec::flat_map(in_items) |in_item| { @@ -281,8 +281,8 @@ impl ext_ctxt: ext_ctxt_helpers { fn clone_folder() -> fold::ast_fold { fold::make_fold(@{ - new_id: |_id| self.next_id() - with *fold::default_ast_fold() + new_id: |_id| self.next_id(), + .. *fold::default_ast_fold() }) } @@ -311,8 +311,8 @@ impl ext_ctxt: ext_ctxt_helpers { } let fld = fold::make_fold(@{ - new_span: |a| repl_sp(a, ast_util::dummy_sp(), span) - with *fold::default_ast_fold() + new_span: |a| repl_sp(a, ast_util::dummy_sp(), span), + .. *fold::default_ast_fold() }); fld.fold_expr(expr) @@ -799,8 +799,8 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, vec::map(tps, |tp| { let cloned = cx.clone_ty_param(tp); {bounds: @(vec::append(*cloned.bounds, - ~[ast::bound_copy])) - with cloned} + ~[ast::bound_copy])), + .. cloned} })); let deser_blk = cx.expr_blk(f(cx, tps_map, #ast[expr]{__d})); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 54c1f496a2f..984ac9fb0e3 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -160,7 +160,7 @@ fn expand_mod_items(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt, } }; - return {items: new_items with module_}; + return {items: new_items,.. module_}; } @@ -259,8 +259,8 @@ fn expand_crate(parse_sess: parse::parse_sess, @{fold_expr: |a,b,c| expand_expr(exts, cx, a, b, c, afp.fold_expr), fold_mod: |a,b| expand_mod_items(exts, cx, a, b, afp.fold_mod), fold_item: |a,b| expand_item(exts, cx, a, b, afp.fold_item), - new_span: |a|new_span(cx, a) - with *afp}; + new_span: |a|new_span(cx, a), + .. *afp}; let f = make_fold(f_pre); let cm = parse_expr_from_source_str(~"<core-macros>", @core_macros(), diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 138d7b755c3..9edf97daaee 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -35,13 +35,13 @@ trait append_types { impl @ast::path: append_types { fn add_ty(ty: @ast::ty) -> @ast::path { - @{types: vec::append_one(self.types, ty) - with *self} + @{types: vec::append_one(self.types, ty), + .. *self} } fn add_tys(+tys: ~[@ast::ty]) -> @ast::path { - @{types: vec::append(self.types, tys) - with *self} + @{types: vec::append(self.types, tys), + .. *self} } } diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index 7d03eb17551..4ebd3eafe3d 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -117,8 +117,8 @@ impl @ast::pat: qq_helper { fn gather_anti_quotes<N: qq_helper>(lo: uint, node: N) -> aq_ctxt { let v = @{visit_expr: |node, &&cx, v| visit_aq(node, ~"from_expr", cx, v), - visit_ty: |node, &&cx, v| visit_aq(node, ~"from_ty", cx, v) - with *default_visitor()}; + visit_ty: |node, &&cx, v| visit_aq(node, ~"from_ty", cx, v), + .. *default_visitor()}; let cx = @{lo:lo, gather: DVec()}; node.visit(cx, mk_vt(v)); // FIXME (#2250): Maybe this is an overkill (merge_sort), it might @@ -301,8 +301,8 @@ fn replace<T>(node: T, repls: ~[fragment], ff: fn (ast_fold, T) -> T) let f_pre = @{fold_expr: |a,b,c|replace_expr(repls, a, b, c, aft.fold_expr), fold_ty: |a,b,c|replace_ty(repls, a, b, c, - aft.fold_ty) - with *aft}; + aft.fold_ty), + .. *aft}; return ff(make_fold(f_pre), node); } fn fold_crate(f: ast_fold, &&n: @ast::crate) -> @ast::crate { diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index e1cb1cf4806..6583a37c1f8 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -196,8 +196,8 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr { map_exprs: |x,y| transcribe_exprs(cx, b, idx_path, x, y) , - new_id: |x|new_id(x, cx) - with *afp}; + new_id: |x|new_id(x, cx), + .. *afp}; let f = make_fold(f_pre); let result = f.fold_expr(body); return result; @@ -246,8 +246,8 @@ fn free_vars(b: bindings, e: @expr, it: fn(ident)) { // using fold is a hack: we want visit, but it doesn't hit idents ) : // solve this with macros let f_pre = - @{fold_ident: |x,y|mark_ident(x, y, b, idents) - with *default_ast_fold()}; + @{fold_ident: |x,y|mark_ident(x, y, b, idents), + .. *default_ast_fold()}; let f = make_fold(f_pre); f.fold_expr(e); // ignore result for idents.each_key |x| { it(x); }; diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 9f5de7f7412..976a57a919c 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -278,10 +278,10 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold) node: { body: fld.fold_block(constructor.node.body), dec: fold_fn_decl(constructor.node.dec, fld), - id: fld.new_id(constructor.node.id) - with constructor.node - } - with constructor + id: fld.new_id(constructor.node.id), + .. constructor.node + }, + .. constructor }); } } @@ -289,8 +289,8 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold) let dtor_body = fld.fold_block(dtor.node.body); let dtor_id = fld.new_id(dtor.node.id); {node: {body: dtor_body, - id: dtor_id with dtor.node} - with dtor}}; + id: dtor_id,.. dtor.node}, + .. dtor}}; return @{ traits: vec::map(struct_def.traits, |p| fold_trait_ref(p, fld)), fields: vec::map(struct_def.fields, |f| fold_struct_field(f, fld)), @@ -467,14 +467,14 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr_fn(proto, fold_fn_decl(decl, fld), fld.fold_block(body), @((*captures).map(|cap_item| { - @({id: fld.new_id((*cap_item).id) - with *cap_item})}))) + @({id: fld.new_id((*cap_item).id), + .. *cap_item})}))) } expr_fn_block(decl, body, captures) => { expr_fn_block(fold_fn_decl(decl, fld), fld.fold_block(body), @((*captures).map(|cap_item| { - @({id: fld.new_id((*cap_item).id) - with *cap_item})}))) + @({id: fld.new_id((*cap_item).id), + .. *cap_item})}))) } expr_block(blk) => expr_block(fld.fold_block(blk)), expr_move(el, er) => { @@ -575,8 +575,8 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ { let dtor_body = fld.fold_block(dtor.node.body); let dtor_id = fld.new_id(dtor.node.id); {node: {body: dtor_body, - id: dtor_id with dtor.node} - with dtor}}; + id: dtor_id,.. dtor.node}, + .. dtor}}; kind = struct_variant_kind(@{ traits: ~[], fields: vec::map(struct_def.fields, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5f91d22f5d0..eca6063df39 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -776,7 +776,7 @@ struct parser { return @{span: mk_sp(lo, tps.span.hi), rp: rp, - types: tps.node with *path}; + types: tps.node,.. *path}; } fn parse_mutability() -> mutability { @@ -1000,11 +1000,9 @@ struct parser { self.bump(); let mut fields = ~[]; vec::push(fields, self.parse_field(token::COLON)); - while self.token != token::RBRACE && - !self.is_keyword(~"with") { + while self.token != token::RBRACE { self.expect(token::COMMA); if self.token == token::RBRACE || - self.is_keyword(~"with") || self.token == token::DOTDOT { // Accept an optional trailing comma. break; @@ -1013,7 +1011,7 @@ struct parser { } let base; - if self.eat_keyword(~"with") || self.eat(token::DOTDOT) { + if self.eat(token::DOTDOT) { base = Some(self.parse_expr()); } else { base = None; @@ -1572,8 +1570,8 @@ struct parser { let last_arg = self.mk_expr(block.span.lo, block.span.hi, ctor(block)); let args = vec::append(args, ~[last_arg]); - @{node: expr_call(f, args, true) - with *e} + @{node: expr_call(f, args, true), + .. *e} } expr_path(*) | expr_field(*) | expr_call(*) => { let block = self.parse_lambda_block_expr(); @@ -1661,18 +1659,6 @@ struct parser { base = Some(self.parse_expr()); break; } - // XXX: Remove "with" after all code is converted over and there's - // a snapshot. - - // optional comma before "with" - if self.token == token::COMMA - && self.token_is_keyword(~"with", - self.look_ahead(1u)) { - self.bump(); - } - if self.eat_keyword(~"with") { - base = Some(self.parse_expr()); break; - } self.expect(token::COMMA); if self.token == token::RBRACE { // record ends by an optional trailing comma @@ -2230,7 +2216,7 @@ struct parser { token::SEMI => { self.bump(); push(stmts, - @{node: stmt_semi(e, stmt_id) with *stmt}); + @{node: stmt_semi(e, stmt_id),.. *stmt}); } token::RBRACE => { expr = Some(e); @@ -2741,8 +2727,8 @@ struct parser { let lo = self.last_span.lo; let (decl_, _) = self.parse_fn_decl(|p| p.parse_arg()); let decl = {output: @{id: self.get_id(), - node: result_ty, span: decl_.output.span} - with decl_}; + node: result_ty, span: decl_.output.span}, + .. decl_}; let body = self.parse_block(); ctor_decl(decl, attrs, body, mk_sp(lo, self.last_span.hi)) } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 1422c2c8b90..a9bcb762597 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -388,8 +388,7 @@ fn contextual_keyword_table() -> hashmap<~str, ()> { ~"move", ~"priv", ~"pub", ~"self", ~"send", ~"static", - ~"use", - ~"with" + ~"use" ]; for keys.each |word| { words.insert(word, ()); |
