Skip to content

Commit 85d1bbf

Browse files
committed
---
yaml --- r: 8051 b: refs/heads/snap-stage3 c: 3604f36 h: refs/heads/master i: 8049: 996abf3 8047: 1c97f24 v: v3
1 parent ca49192 commit 85d1bbf

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 42e25b2bb91118ff40e110129808451a762e7f5c
4+
refs/heads/snap-stage3: 3604f36938f46104d8b538edbcbd322e4829a081
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/comp/syntax/fold.rs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,36 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
415415
}
416416
}
417417

418-
fn noop_fold_ty(t: ty_, _fld: ast_fold) -> ty_ {
419-
//drop in ty::fold_ty here if necessary
420-
ret t;
418+
fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
419+
let fold_mac = bind fold_mac_(_, fld);
420+
fn fold_mt(mt: mt, fld: ast_fold) -> mt {
421+
{ty: fld.fold_ty(mt.ty), mut: mt.mut}
422+
}
423+
fn fold_field(f: ty_field, fld: ast_fold) -> ty_field {
424+
{node: {ident: fld.fold_ident(f.node.ident),
425+
mt: fold_mt(f.node.mt, fld)},
426+
span: fld.new_span(f.span)}
427+
}
428+
alt t {
429+
ty_nil | ty_bot | ty_bool | ty_str {t}
430+
ty_int(_) | ty_uint(_) | ty_float(_) {t}
431+
ty_box(mt) {ty_box(fold_mt(mt, fld))}
432+
ty_uniq(mt) {ty_uniq(fold_mt(mt, fld))}
433+
ty_vec(mt) {ty_vec(fold_mt(mt, fld))}
434+
ty_ptr(mt) {ty_ptr(fold_mt(mt, fld))}
435+
ty_task {t}
436+
ty_port(ty) {ty_port(fld.fold_ty(ty))}
437+
ty_chan(ty) {ty_chan(fld.fold_ty(ty))}
438+
ty_rec(fields) {ty_rec(vec::map(fields) {|f| fold_field(f, fld)})}
439+
ty_fn(proto, decl) {ty_fn(proto, fold_fn_decl(decl, fld))}
440+
ty_tup(tys) {ty_tup(vec::map(tys) {|ty| fld.fold_ty(ty)})}
441+
ty_path(path, id) {ty_path(fld.fold_path(path), fld.new_id(id))}
442+
ty_type {t}
443+
// FIXME: constrs likely needs to be folded...
444+
ty_constr(ty, constrs) {ty_constr(fld.fold_ty(ty), constrs)}
445+
ty_mac(mac) {ty_mac(fold_mac(mac))}
446+
ty_infer {t}
447+
}
421448
}
422449

423450
fn noop_fold_constr(c: constr_, fld: ast_fold) -> constr_ {

0 commit comments

Comments
 (0)