Skip to content

Commit 4df433f

Browse files
committed
---
yaml --- r: 47214 b: refs/heads/try c: 44f5537 h: refs/heads/master v: v3
1 parent 1006811 commit 4df433f

File tree

7 files changed

+107
-77
lines changed

7 files changed

+107
-77
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: 5b9e110eab9c30428e99995a0adbec82857e3a1a
5+
refs/heads/try: 44f5537abf31ac2f931f343a22a85432feb619e1
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libsyntax/attr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
209209

210210
pub fn contains_name(metas: &[@ast::meta_item], name: &str) -> bool {
211211
let matches = find_meta_items_by_name(metas, name);
212-
return vec::len(matches) > 0u;
212+
matches.len() > 0u
213213
}
214214

215215
pub fn attrs_contains_name(attrs: &[ast::attribute], name: &str) -> bool {
@@ -227,14 +227,14 @@ pub fn first_attr_value_str_by_name(attrs: ~[ast::attribute], name: &str)
227227
}
228228
}
229229

230-
fn last_meta_item_by_name(items: ~[@ast::meta_item], name: &str)
230+
fn last_meta_item_by_name(items: &[@ast::meta_item], name: &str)
231231
-> Option<@ast::meta_item> {
232232

233233
let items = attr::find_meta_items_by_name(items, name);
234234
vec::last_opt(items)
235235
}
236236

237-
pub fn last_meta_item_value_str_by_name(items: ~[@ast::meta_item], name: &str)
237+
pub fn last_meta_item_value_str_by_name(items: &[@ast::meta_item], name: &str)
238238
-> Option<@~str> {
239239

240240
match last_meta_item_by_name(items, name) {

branches/try/src/libsyntax/ext/auto_encode.rs

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn expand_auto_encode(
120120
fn filter_attrs(item: @ast::item) -> @ast::item {
121121
@ast::item {
122122
attrs: item.attrs.filtered(|a| !is_auto_encode(a)),
123-
.. *item
123+
.. copy *item
124124
}
125125
}
126126

@@ -175,7 +175,7 @@ pub fn expand_auto_decode(
175175
fn filter_attrs(item: @ast::item) -> @ast::item {
176176
@ast::item {
177177
attrs: item.attrs.filtered(|a| !is_auto_decode(a)),
178-
.. *item
178+
.. copy *item
179179
}
180180
}
181181

@@ -237,7 +237,7 @@ priv impl ext_ctxt {
237237
}
238238
}
239239

240-
fn expr(span: span, node: ast::expr_) -> @ast::expr {
240+
fn expr(span: span, +node: ast::expr_) -> @ast::expr {
241241
@ast::expr {
242242
id: self.next_id(),
243243
callee_id: self.next_id(),
@@ -246,7 +246,7 @@ priv impl ext_ctxt {
246246
}
247247
}
248248

249-
fn path(span: span, strs: ~[ast::ident]) -> @ast::path {
249+
fn path(span: span, +strs: ~[ast::ident]) -> @ast::path {
250250
@ast::path {
251251
span: span,
252252
global: false,
@@ -256,7 +256,7 @@ priv impl ext_ctxt {
256256
}
257257
}
258258

259-
fn path_global(span: span, strs: ~[ast::ident]) -> @ast::path {
259+
fn path_global(span: span, +strs: ~[ast::ident]) -> @ast::path {
260260
@ast::path {
261261
span: span,
262262
global: true,
@@ -266,8 +266,11 @@ priv impl ext_ctxt {
266266
}
267267
}
268268

269-
fn path_tps(span: span, strs: ~[ast::ident],
270-
tps: ~[@ast::Ty]) -> @ast::path {
269+
fn path_tps(
270+
span: span,
271+
+strs: ~[ast::ident],
272+
+tps: ~[@ast::Ty]
273+
) -> @ast::path {
271274
@ast::path {
272275
span: span,
273276
global: false,
@@ -277,8 +280,11 @@ priv impl ext_ctxt {
277280
}
278281
}
279282

280-
fn path_tps_global(span: span, strs: ~[ast::ident],
281-
tps: ~[@ast::Ty]) -> @ast::path {
283+
fn path_tps_global(
284+
span: span,
285+
+strs: ~[ast::ident],
286+
+tps: ~[@ast::Ty]
287+
) -> @ast::path {
282288
@ast::path {
283289
span: span,
284290
global: true,
@@ -288,8 +294,11 @@ priv impl ext_ctxt {
288294
}
289295
}
290296

291-
fn ty_path(span: span, strs: ~[ast::ident],
292-
tps: ~[@ast::Ty]) -> @ast::Ty {
297+
fn ty_path(
298+
span: span,
299+
+strs: ~[ast::ident],
300+
+tps: ~[@ast::Ty]
301+
) -> @ast::Ty {
293302
@ast::Ty {
294303
id: self.next_id(),
295304
node: ast::ty_path(
@@ -335,13 +344,13 @@ priv impl ext_ctxt {
335344
span: span}))
336345
}
337346

338-
fn lambda(blk: ast::blk) -> @ast::expr {
347+
fn lambda(+blk: ast::blk) -> @ast::expr {
339348
let ext_cx = self;
340349
let blk_e = self.expr(blk.span, ast::expr_block(blk));
341350
quote_expr!( || $blk_e )
342351
}
343352

344-
fn blk(span: span, stmts: ~[@ast::stmt]) -> ast::blk {
353+
fn blk(span: span, +stmts: ~[@ast::stmt]) -> ast::blk {
345354
codemap::spanned {
346355
node: ast::blk_ {
347356
view_items: ~[],
@@ -367,15 +376,15 @@ priv impl ext_ctxt {
367376
}
368377
}
369378

370-
fn expr_path(span: span, strs: ~[ast::ident]) -> @ast::expr {
379+
fn expr_path(span: span, +strs: ~[ast::ident]) -> @ast::expr {
371380
self.expr(span, ast::expr_path(self.path(span, strs)))
372381
}
373382

374-
fn expr_path_global(span: span, strs: ~[ast::ident]) -> @ast::expr {
383+
fn expr_path_global(span: span, +strs: ~[ast::ident]) -> @ast::expr {
375384
self.expr(span, ast::expr_path(self.path_global(span, strs)))
376385
}
377386

378-
fn expr_var(span: span, var: ~str) -> @ast::expr {
387+
fn expr_var(span: span, +var: ~str) -> @ast::expr {
379388
self.expr_path(span, ~[self.ident_of(var)])
380389
}
381390

@@ -390,7 +399,7 @@ priv impl ext_ctxt {
390399
fn expr_call(
391400
span: span,
392401
expr: @ast::expr,
393-
args: ~[@ast::expr]
402+
+args: ~[@ast::expr]
394403
) -> @ast::expr {
395404
self.expr(span, ast::expr_call(expr, args, ast::NoSugar))
396405
}
@@ -399,7 +408,7 @@ priv impl ext_ctxt {
399408
self.lambda(self.expr_blk(expr))
400409
}
401410

402-
fn lambda_stmts(span: span, stmts: ~[@ast::stmt]) -> @ast::expr {
411+
fn lambda_stmts(span: span, +stmts: ~[@ast::stmt]) -> @ast::expr {
403412
self.lambda(self.blk(span, stmts))
404413
}
405414
}
@@ -545,7 +554,7 @@ fn mk_deser_impl(
545554
fn mk_ser_method(
546555
cx: ext_ctxt,
547556
span: span,
548-
ser_body: ast::blk
557+
+ser_body: ast::blk
549558
) -> @ast::method {
550559
let ty_s = @ast::Ty {
551560
id: cx.next_id(),
@@ -609,7 +618,7 @@ fn mk_deser_method(
609618
cx: ext_ctxt,
610619
span: span,
611620
ty: @ast::Ty,
612-
deser_body: ast::blk
621+
+deser_body: ast::blk
613622
) -> @ast::method {
614623
let ty_d = @ast::Ty {
615624
id: cx.next_id(),
@@ -947,7 +956,7 @@ fn mk_enum_ser_body(
947956
cx: ext_ctxt,
948957
span: span,
949958
name: ast::ident,
950-
variants: ~[ast::variant]
959+
+variants: ~[ast::variant]
951960
) -> @ast::expr {
952961
let arms = do variants.mapi |v_idx, variant| {
953962
match variant.node.kind {

branches/try/src/libsyntax/ext/pipes/ast_builder.rs

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ mod syntax {
3333
pub use parse;
3434
}
3535

36-
pub fn path(ids: ~[ident], span: span) -> @ast::path {
36+
pub fn path(+ids: ~[ident], span: span) -> @ast::path {
3737
@ast::path { span: span,
3838
global: false,
3939
idents: ids,
4040
rp: None,
4141
types: ~[] }
4242
}
4343

44-
pub fn path_global(ids: ~[ident], span: span) -> @ast::path {
44+
pub fn path_global(+ids: ~[ident], span: span) -> @ast::path {
4545
@ast::path { span: span,
4646
global: true,
4747
idents: ids,
@@ -50,19 +50,23 @@ pub fn path_global(ids: ~[ident], span: span) -> @ast::path {
5050
}
5151

5252
pub trait append_types {
53-
fn add_ty(ty: @ast::Ty) -> @ast::path;
54-
fn add_tys(+tys: ~[@ast::Ty]) -> @ast::path;
53+
fn add_ty(&self, ty: @ast::Ty) -> @ast::path;
54+
fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::path;
5555
}
5656

5757
pub impl append_types for @ast::path {
58-
fn add_ty(ty: @ast::Ty) -> @ast::path {
59-
@ast::path { types: vec::append_one(self.types, ty),
60-
.. *self}
58+
fn add_ty(&self, ty: @ast::Ty) -> @ast::path {
59+
@ast::path {
60+
types: vec::append_one(copy self.types, ty),
61+
.. **self
62+
}
6163
}
6264

63-
fn add_tys(+tys: ~[@ast::Ty]) -> @ast::path {
64-
@ast::path { types: vec::append(self.types, tys),
65-
.. *self}
65+
fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::path {
66+
@ast::path {
67+
types: vec::append(copy self.types, tys),
68+
.. **self
69+
}
6670
}
6771
}
6872

@@ -73,24 +77,28 @@ pub trait ext_ctxt_ast_builder {
7377
fn expr_block(&self, e: @ast::expr) -> ast::blk;
7478
fn fn_decl(&self, +inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl;
7579
fn item(&self, name: ident, span: span, +node: ast::item_) -> @ast::item;
76-
fn item_fn_poly(&self, name: ident,
77-
+inputs: ~[ast::arg],
78-
output: @ast::Ty,
79-
+ty_params: ~[ast::ty_param],
80-
+body: ast::blk) -> @ast::item;
81-
fn item_fn(&self, name: ident,
82-
+inputs: ~[ast::arg],
83-
output: @ast::Ty,
84-
+body: ast::blk) -> @ast::item;
85-
fn item_enum_poly(&self, name: ident,
86-
span: span,
87-
+enum_definition: ast::enum_def,
88-
+ty_params: ~[ast::ty_param]) -> @ast::item;
80+
fn item_fn_poly(&self,
81+
name: ident,
82+
+inputs: ~[ast::arg],
83+
output: @ast::Ty,
84+
+ty_params: ~[ast::ty_param],
85+
+body: ast::blk) -> @ast::item;
86+
fn item_fn(&self,
87+
name: ident,
88+
+inputs: ~[ast::arg],
89+
output: @ast::Ty,
90+
+body: ast::blk) -> @ast::item;
91+
fn item_enum_poly(&self,
92+
name: ident,
93+
span: span,
94+
+enum_definition: ast::enum_def,
95+
+ty_params: ~[ast::ty_param]) -> @ast::item;
8996
fn item_enum(&self, name: ident, span: span,
9097
+enum_definition: ast::enum_def) -> @ast::item;
91-
fn item_struct_poly(&self, name: ident, span: span,
92-
struct_def: ast::struct_def,
93-
ty_params: ~[ast::ty_param]) -> @ast::item;
98+
fn item_struct_poly(&self,
99+
name: ident, span: span,
100+
struct_def: ast::struct_def,
101+
+ty_params: ~[ast::ty_param]) -> @ast::item;
94102
fn item_struct(&self, name: ident, span: span,
95103
struct_def: ast::struct_def) -> @ast::item;
96104
fn struct_expr(&self, path: @ast::path,
@@ -105,14 +113,14 @@ pub trait ext_ctxt_ast_builder {
105113
ty: @ast::Ty,
106114
+params: ~[ast::ty_param]) -> @ast::item;
107115
fn item_ty(&self, name: ident, span: span, ty: @ast::Ty) -> @ast::item;
108-
fn ty_vars(&self, +ty_params: ~[ast::ty_param]) -> ~[@ast::Ty];
109-
fn ty_vars_global(&self, +ty_params: ~[ast::ty_param]) -> ~[@ast::Ty];
116+
fn ty_vars(&self, ty_params: &[ast::ty_param]) -> ~[@ast::Ty];
117+
fn ty_vars_global(&self, ty_params: &[ast::ty_param]) -> ~[@ast::Ty];
110118
fn ty_field_imm(&self, name: ident, ty: @ast::Ty) -> ast::ty_field;
111119
fn field_imm(&self, name: ident, e: @ast::expr) -> ast::field;
112120
fn block(&self, +stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk;
113121
fn stmt_let(&self, ident: ident, e: @ast::expr) -> @ast::stmt;
114122
fn stmt_expr(&self, e: @ast::expr) -> @ast::stmt;
115-
fn block_expr(&self, b: ast::blk) -> @ast::expr;
123+
fn block_expr(&self, +b: ast::blk) -> @ast::expr;
116124
fn ty_option(&self, ty: @ast::Ty) -> @ast::Ty;
117125
fn ty_infer(&self) -> @ast::Ty;
118126
fn ty_nil_ast_builder(&self) -> @ast::Ty;
@@ -128,7 +136,7 @@ pub impl ext_ctxt_ast_builder for ext_ctxt {
128136
], dummy_sp()).add_ty(ty))
129137
}
130138

131-
fn block_expr(&self, b: ast::blk) -> @ast::expr {
139+
fn block_expr(&self, +b: ast::blk) -> @ast::expr {
132140
@expr {
133141
id: self.next_id(),
134142
callee_id: self.next_id(),
@@ -282,7 +290,7 @@ pub impl ext_ctxt_ast_builder for ext_ctxt {
282290

283291
fn item_struct_poly(&self, name: ident, span: span,
284292
struct_def: ast::struct_def,
285-
ty_params: ~[ast::ty_param]) -> @ast::item {
293+
+ty_params: ~[ast::ty_param]) -> @ast::item {
286294
self.item(name, span, ast::item_struct(@struct_def, ty_params))
287295
}
288296

@@ -386,12 +394,12 @@ pub impl ext_ctxt_ast_builder for ext_ctxt {
386394
self.item_ty_poly(name, span, ty, ~[])
387395
}
388396

389-
fn ty_vars(&self, +ty_params: ~[ast::ty_param]) -> ~[@ast::Ty] {
397+
fn ty_vars(&self, +ty_params: &[ast::ty_param]) -> ~[@ast::Ty] {
390398
ty_params.map(|p| self.ty_path_ast_builder(
391399
path(~[p.ident], dummy_sp())))
392400
}
393401

394-
fn ty_vars_global(&self, +ty_params: ~[ast::ty_param]) -> ~[@ast::Ty] {
402+
fn ty_vars_global(&self, ty_params: &[ast::ty_param]) -> ~[@ast::Ty] {
395403
ty_params.map(|p| self.ty_path_ast_builder(
396404
path(~[p.ident], dummy_sp())))
397405
}

branches/try/src/libsyntax/ext/pipes/pipec.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ pub impl gen_send for message {
5858
let next = this.proto.get_state(next_state.state);
5959
assert next_state.tys.len() == next.ty_params.len();
6060
let arg_names = tys.mapi(|i, _ty| cx.ident_of(~"x_"+i.to_str()));
61-
62-
let args_ast = (arg_names, *tys).map(|n, t| cx.arg(*n, *t));
61+
let args_ast = vec::map2(arg_names, *tys, |n, t| cx.arg(*n, *t));
6362

6463
let pipe_ty = cx.ty_path_ast_builder(
6564
path(~[this.data_name()], span)
@@ -137,7 +136,7 @@ pub impl gen_send for message {
137136
debug!("pipec: no next state");
138137
let arg_names = tys.mapi(|i, _ty| (~"x_" + i.to_str()));
139138
140-
let args_ast = do (arg_names, *tys).map |n, t| {
139+
let args_ast = do vec::map2(arg_names, *tys) |n, t| {
141140
cx.arg(cx.ident_of(*n), *t)
142141
};
143142

branches/try/src/libsyntax/ext/pipes/proto.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ pub impl state_ {
120120

121121
pub type protocol = @mut protocol_;
122122

123-
pub fn protocol(name: ~str, +span: span) -> protocol {
123+
pub fn protocol(+name: ~str, +span: span) -> protocol {
124124
@mut protocol_(name, span)
125125
}
126126

127-
pub fn protocol_(name: ~str, span: span) -> protocol_ {
127+
pub fn protocol_(+name: ~str, span: span) -> protocol_ {
128128
protocol_ {
129129
name: name,
130130
span: span,
@@ -174,7 +174,7 @@ pub impl protocol_ {
174174
}
175175

176176
pub impl protocol {
177-
fn add_state_poly(&self, name: ~str, ident: ast::ident, dir: direction,
177+
fn add_state_poly(&self, +name: ~str, ident: ast::ident, dir: direction,
178178
+ty_params: ~[ast::ty_param]) -> state {
179179
let messages = @mut ~[];
180180

0 commit comments

Comments
 (0)