diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-12-23 02:16:31 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-12-23 02:16:31 +0000 |
| commit | 31d9cc3833a30b0cd4c1554102402af68eebeeef (patch) | |
| tree | b9633742dac484d7cbadb4366ed80e82fa5d355b /src/libsyntax | |
| parent | c217ab6c8dc1a305304b00a414be5f39ea6a2c81 (diff) | |
| download | rust-31d9cc3833a30b0cd4c1554102402af68eebeeef.tar.gz rust-31d9cc3833a30b0cd4c1554102402af68eebeeef.zip | |
Fix import resolution bug and fold all idents in the AST.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/fold.rs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index b3753e3e977..6f938197275 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -302,23 +302,22 @@ pub fn noop_fold_view_path<T: Folder>(view_path: P<ViewPath>, fld: &mut T) -> P< view_path.map(|Spanned {node, span}| Spanned { node: match node { ViewPathSimple(ident, path) => { - ViewPathSimple(ident, fld.fold_path(path)) + ViewPathSimple(fld.fold_ident(ident), fld.fold_path(path)) } ViewPathGlob(path) => { ViewPathGlob(fld.fold_path(path)) } ViewPathList(path, path_list_idents) => { - ViewPathList(fld.fold_path(path), - path_list_idents.move_map(|path_list_ident| { - Spanned { - node: PathListItem_ { - id: fld.new_id(path_list_ident.node.id), - rename: path_list_ident.node.rename, - name: path_list_ident.node.name, - }, - span: fld.new_span(path_list_ident.span) - } - })) + let path = fld.fold_path(path); + let path_list_idents = path_list_idents.move_map(|path_list_ident| Spanned { + node: PathListItem_ { + id: fld.new_id(path_list_ident.node.id), + rename: path_list_ident.node.rename.map(|ident| fld.fold_ident(ident)), + name: fld.fold_ident(path_list_ident.node.name), + }, + span: fld.new_span(path_list_ident.span) + }); + ViewPathList(path, path_list_idents) } }, span: fld.new_span(span) @@ -345,7 +344,7 @@ pub fn noop_fold_arm<T: Folder>(Arm {attrs, pats, guard, body}: Arm, fld: &mut T pub fn noop_fold_ty_binding<T: Folder>(b: TypeBinding, fld: &mut T) -> TypeBinding { TypeBinding { id: fld.new_id(b.id), - ident: b.ident, + ident: fld.fold_ident(b.ident), ty: fld.fold_ty(b.ty), span: fld.new_span(b.span), } @@ -673,7 +672,7 @@ pub fn noop_fold_ty_param<T: Folder>(tp: TyParam, fld: &mut T) -> TyParam { .collect::<Vec<_>>() .into(), id: fld.new_id(id), - ident: ident, + ident: fld.fold_ident(ident), bounds: fld.fold_bounds(bounds), default: default.map(|x| fld.fold_ty(x)), span: span @@ -1088,7 +1087,7 @@ pub fn noop_fold_pat<T: Folder>(p: P<Pat>, folder: &mut T) -> P<Pat> { let fs = fields.move_map(|f| { Spanned { span: folder.new_span(f.span), node: ast::FieldPat { - ident: f.node.ident, + ident: folder.fold_ident(f.node.ident), pat: folder.fold_pat(f.node.pat), is_shorthand: f.node.is_shorthand, }} |
