Skip to content

Commit 81a44cc

Browse files
committed
Remove hack to break the AST fold cycle. Closes #998
1 parent 160c56e commit 81a44cc

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

src/comp/syntax/fold.rs

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export ast_fold_precursor;
77
export ast_fold;
88
export default_ast_fold;
99
export make_fold;
10-
export dummy_out;
1110
export noop_fold_crate;
1211
export noop_fold_item;
1312
export noop_fold_expr;
@@ -529,42 +528,7 @@ fn default_ast_fold() -> @ast_fold_precursor {
529528
new_span: noop_span};
530529
}
531530

532-
fn dummy_out(a: ast_fold) {
533-
*a =
534-
{fold_crate: nf_crate_dummy,
535-
fold_crate_directive: nf_crate_directive_dummy,
536-
fold_view_item: nf_view_item_dummy,
537-
fold_native_item: nf_native_item_dummy,
538-
fold_item: nf_item_dummy,
539-
fold_item_underscore: nf_item_underscore_dummy,
540-
fold_method: nf_method_dummy,
541-
fold_block: nf_blk_dummy,
542-
fold_stmt: nf_stmt_dummy,
543-
fold_arm: nf_arm_dummy,
544-
fold_pat: nf_pat_dummy,
545-
fold_decl: nf_decl_dummy,
546-
fold_expr: nf_expr_dummy,
547-
fold_ty: nf_ty_dummy,
548-
fold_constr: nf_constr_dummy,
549-
fold_fn: nf_fn_dummy,
550-
fold_mod: nf_mod_dummy,
551-
fold_native_mod: nf_native_mod_dummy,
552-
fold_variant: nf_variant_dummy,
553-
fold_ident: nf_ident_dummy,
554-
fold_path: nf_path_dummy,
555-
fold_local: nf_local_dummy,
556-
map_exprs: noop_map_exprs,
557-
new_id: noop_id,
558-
new_span: noop_span};
559-
}
560-
561-
// FIXME: Fold has a circular reference that has to be broken. With GC this
562-
// can go away
563-
resource foldres(f: ast_fold) {
564-
dummy_out(f);
565-
}
566-
567-
fn make_fold(afp: ast_fold_precursor) -> @foldres {
531+
fn make_fold(afp: ast_fold_precursor) -> ast_fold {
568532
// FIXME: Have to bind all the bare functions into shared functions
569533
// because @mutable is invariant with respect to its contents
570534
let result: ast_fold =
@@ -702,7 +666,7 @@ fn make_fold(afp: ast_fold_precursor) -> @foldres {
702666
map_exprs: afp.map_exprs,
703667
new_id: afp.new_id,
704668
new_span: afp.new_span};
705-
ret @foldres(result);
669+
ret result;
706670
}
707671

708672

0 commit comments

Comments
 (0)