michaelficarra / CoffeeScriptRedux

:sweat: rewrite of the CoffeeScript compiler with proper compiler design principles and a focus on robustness and extensibility
https://michaelficarra.github.com/CoffeeScriptRedux/
BSD 3-Clause "New" or "Revised" License
1.84k stars 110 forks source link

Fix duplicate vars at top level #349

Closed ef4 closed 9 years ago

ef4 commented 9 years ago

To see the problem this patch fixes, look at the first line of lib/cli.js:

var $0, $0, ...

The Program node handler was attempting to deduplicate with nub, but doing so over a list of JS.Identifiers, not a list of plain strings.

Since most callers of declarationsNeededRecursive are more interested in the set of names than the identifier nodes, I changed it to do that.

michaelficarra commented 9 years ago

Please rebase.

ef4 commented 9 years ago

Rebased and recompiled lib.

michaelficarra commented 9 years ago

Thanks!