jlongster / es6-macros

A collection of sweet.js macros that implement ES6 features for ES5
BSD 2-Clause "Simplified" License
237 stars 18 forks source link

Arrow binding with 1 argument #10

Closed geelen closed 10 years ago

geelen commented 10 years ago

All arrow functions bind this, even with only one argument:

x => x + this.y needs to compile to:

function(x) {
  return x + this.y;
}.bind(this);

This fixes that, and even has tests!

jlongster commented 10 years ago

Awesome, thanks! I actually noticed that before but hadn't pushed a fix. Thanks for including tests & fixing up the other stuff!