Repro:
var api = (function() {
function foo(_, arg) {
console.log("FOO ARG=" + arg);
return arg + " world";
}
return {
foo: foo,
};
})();
function bar(_) {
var result = api.foo(_, "hello");
console.log("RESULT=" + result);
}
bar(function(err) {
console.log("DONE: " + err);
});
Expecting:
FOO ARG=hello
RESULT=hello world
DONE: null
but getting:
Notes:
- this bug only shows up in fibers and generators mode. It does not show up in callbacks mode nor in fast modes.
- this bug only occurs if function are hoisted. If
function bar() is changed to var bar = function() the bug disappears. So it does not impact CoffeeScript code.