Move fns in trans to methods on Block?


#1

I am experimenting with an initial port of trans to work on MIR. The idea is that this will be incomplete, something we can grow. As I repeatedly copy fn signatures like

fn trans_foo<'bcx, 'tcx>(bcx: Block<'bcx, 'tcx>, ...)

I find myself wondering why these are fns in the first place. I feel like it’d be nice to just make methods on Block , like so:

impl<'bcx, 'tcx> BlockS<'bcx, 'tcx> {
    fn trans_foo(self, ...) { ... }
}

I think the main reason the code was not written this way is that methods didn’t exist at the time when the style was set down. Thoughts?


#2

Meh, never mind, while I still think this makes sense, it turns out that the methods will be on a different type, from the way I see things :smile: