musictheory / NilScript

Objective-C-style language superset of JavaScript with a tiny, simple runtime
Other
50 stars 5 forks source link

Transpile 'let' to ES3 'var' #39

Closed iccir closed 9 years ago

iccir commented 9 years ago

ES6 adds block-scoped binding constructs.

Investigate intercepting these and transpiling them back to ES3 'var', similar to defs

iccir commented 9 years ago

I see a win from supporting a subset of 'let' functionality.

Since JSHint already warns about functions inside of loops, I don't know if Loop closures should be transpiled (we could just warn).

In fact, I'm not sure if any capturing of a let variable by a closure should be supported.

iccir commented 9 years ago

Note that with #44, we will be able to feed the resulting AST to 6to5 directly.

iccir commented 9 years ago

This will be handled by #44, which will allow babel to be used as a post-ojc stage.