scala macros to turn closures into local methods