question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception occurs with some code

See original GitHub issue
C:\npmprefix\node_modules\lebab\lib\scope\function-hoister.js:106
            _this2.functionScope.register(node.id.name, new _scopeVariable2['default'](node));
                                                 ^

TypeError: Cannot read property 'name' of null
    at Controller.enter (C:\npmprefix\node_modules\lebab\lib\scope\function-hoister.js:106:50)
    at Controller.__execute (C:\npmprefix\node_modules\lebab\node_modules\estraverse\estraverse.js:397:31)
    at Controller.traverse (C:\npmprefix\node_modules\lebab\node_modules\estraverse\estraverse.js:501:28)
    at Object.traverse (C:\npmprefix\node_modules\lebab\node_modules\estraverse\estraverse.js:713:27)
    at Object.traverse (C:\npmprefix\node_modules\lebab\lib\traverser.js:42:36)
    at FunctionHoister.hoistVariables (C:\npmprefix\node_modules\lebab\lib\scope\function-hoister.js:100:30)
    at FunctionHoister.hoist (C:\npmprefix\node_modules\lebab\lib\scope\function-hoister.js:79:12)
    at hoistFunction (C:\npmprefix\node_modules\lebab\lib\transform\let.js:144:53)
    at enterProgram (C:\npmprefix\node_modules\lebab\lib\transform\let.js:117:3)
    at Controller.enter (C:\npmprefix\node_modules\lebab\lib\transform\let.js:60:9)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
nenecommented, Jul 29, 2016

Ah… thanks. Now I get it.

  • In ES5 one could only have a an anonymous FunctionExpression, but FunctionDeclarations always needed a name.
  • In ES6 however the FunctionDeclarations in default export don’t need a name. But Lebab assumes they always must have a name.

Should be pretty easy to fix.

0reactions
lukeapagecommented, Jul 29, 2016

I patched it locally, so I don’t need a fix, but here is a repro

export default function() {
    var a;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Exception Handling? - SearchSoftwareQuality
Exceptions occur for numerous reasons, including invalid user input, code errors, device failure, the loss of a network connection, insufficient memory to run ......
Read more >
What Is an Exception?
Definition: An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions during the...
Read more >
Run some code if any exception occur and to a specific ...
1 Answer 1 · Ok. So if I get except KeyError, NameError: block, how to check which one occur? – avalanchy · In...
Read more >
What's an Exception and Why Do I Care? - UPV
Definition: An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. Many different...
Read more >
What is exception handler? | Definition from TechTarget
An exception handler is code that stipulates what a program will do when an anomalous event disrupts the normal flow of that program's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found