mozilla/sweet.js — pull request #216 by natefaubion (2014-01-26 03:12:50+00:00)
Title: Refactor letstx

Fixes #215

This is a complete rewrite of `letstx` that handles all sorts of edge cases. The primary problem with the previous `letstx` was that it immediately called `return` which means it couldn't be used in branches or loops. This rewrite avoids `withSyntax` and `syntaxCase` completely, and has a much simpler expansion. It mimics how `let` scope works, and can shadow pattern vars within an inner block without it affecting the outer pattern scope. The rewrite also has a nice consequence of allowing you to load multiple tokens into a pattern var without having to use a repeater, which is far more intuitive. Loading repeaters is still supported though for when you need it.

`withSyntax` should be considered deprecated, and will likely be removed with the 0.5.0 bump.