Open sebmck opened 9 years ago
This involves https://github.com/benjamn/ast-types/blob/master/lib/scope.js more than Regenerator itself, I'd say.
@benjamn Not really. Regenerator is the one that delegates it to ast-types
. I know it seems incredibly pedantic to want to change it but I'm pretty set on 6to5 code output consistency which is what this feature would be used for.
Ah, I see what you mean now. What do you want the temporaries to look like?
Note that .declareTemporary
adds unique-ifying suffixes (the argument you provide is just a prefix), so this may require changes to .declareTemporary
after all, depending on what you're looking for.
@benjamn 6to5 has a generateUid method which is basically the direct equivalent. You provide it a prefix and it prepends it with an underscore and checks to see if there are any variables declared within the current scope to avoid collisions and appends a number.
I'd be willing to submit a PR to demonstrate what I mean but I'm unsure of how to structure it since transform options aren't accessible from the visitor.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
It'd be great to be able to override the
path.scope.declareTemporary
calls used in visit.js with a custom function to generate identifiers.