Take a look at https://github.com/google/traceur-compiler/blob/master/src/codegeneration/AlphaRenamer.js