Arrows uses wrong context
Seems to be something wrong with arrows and context. Native this works, but not the other way around.
The example describe what happend. If I try the same code on NodeJS 6.x without Buble, the code works as expected.
function foo(args...) {
const Domain = domain.create(); // deprecated I know
return Domain.run(() => {
return this.Foo2(...args); // Buble transpile this into "return this_.Foo2.apply(this_, args);"
});
}
function Foo2(...args) {
// if you try this with buble and "console.log(this);" you will see that the this is the Domain
// However this was done inside a class, but this is what happend
}