babeljs - Async function not getting hoisted in Babel 6 -
trying compile piece of code in babel 6
function a() { return async function b() { some.thing = c; async function c() {} } }
the async function c
supposed hoisted up, right? , on babel's online repl site:
... c = function c() { ... }; some.thing = c; ...
but on system compiles differently (and incorrectly):
... some.thing = c; c = (function () { var ref = _asynctogenerator(regeneratorruntime.mark(function _callee() { ...
here c
defined variable , not getting hoisted, results in some.thing
undefined
why difference on system? i'm using babel 6.3 presets: ['es2015', 'stage-0']
this known bug in babel 6. issue tracked in https://phabricator.babeljs.io/t6760
Comments
Post a Comment