]> git.lizzy.rs Git - rust.git/commit
Extended `syntax::{fold, ast_map}` to include lifetimes.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Fri, 11 Apr 2014 09:28:43 +0000 (11:28 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Thu, 17 Apr 2014 09:42:30 +0000 (11:42 +0200)
commitb25fe99331a114b92131ecd4bd37abefb2508ff0
tree940fd3c9b8a0b4ef3a2cef514f8192754235683c
parent0e30f07abc76587f676e91770b7630ac9727b2cb
Extended `syntax::{fold, ast_map}` to include lifetimes.

Part of this required added an override of `fold_type_method` in the
Folder for Ctx impl; it follows the same pattern as `fold_method`.

Also, as a drive-by fix, I moved all of the calls to `folder.new_id`
in syntax::fold's no-op default traversal to really be the first
statement in each function.

  * This is to uphold the invariant that `folder.new_id` is always
    called first (an unfortunate requirement of the current `ast_map`
    code), an invariant that we seemingly were breaking in e.g. the
    previous `noop_fold_block`.

  * Now it should be easier to see when adding new code that this
    invariant must be upheld.

  * (note that the breakage in `noop_fold_block` may not have mattered
    so much previously, since the only thing that blocks can bind are
    lifetimes, which I am only adding support for now.)
src/librustc/middle/trans/monomorphize.rs
src/libsyntax/ast_map.rs
src/libsyntax/fold.rs