You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.
There's a weird issue I'm trying to resolve that shows up when dealing with a hoisted function declaration vs a function expression. I've trimmed my code down to the bare minimum to reproduce the problem.
When executing node index.js (using node 0.11+ without the --harmony-generators flag) I get the following error:
/Users/dominic/Desktop/test/es6.js:8
}, named, this);
^
ReferenceError: named is not defined
at named (/Users/dominic/Desktop/test/es6.js:8:6)
at Object.<anonymous> (/Users/dominic/Desktop/test/index.js:3:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Changing es6.js to the following fixes the issue:
module.exports=named;function*named(){}
So, it appears like there's some sort of weird scope issue regarding the exported function. Oddly enough, using a name with 2 or fewer characters works regardless.
This could be an issue with regenerator itself, but for some reason I can't reproduce this bug using regenerator directly, only when using require('gnode');.
The text was updated successfully, but these errors were encountered:
There's a weird issue I'm trying to resolve that shows up when dealing with a hoisted function declaration vs a function expression. I've trimmed my code down to the bare minimum to reproduce the problem.
index.js
es6.js
When executing
node index.js
(using node 0.11+ without the--harmony-generators
flag) I get the following error:Changing
es6.js
to the following fixes the issue:So, it appears like there's some sort of weird scope issue regarding the exported function. Oddly enough, using a name with 2 or fewer characters works regardless.
This could be an issue with regenerator itself, but for some reason I can't reproduce this bug using regenerator directly, only when using
require('gnode');
.The text was updated successfully, but these errors were encountered: