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.

Function declarations hide unreachable code

See original GitHub issue

Unreachable 'var' after 'return'. on the following:

function main() {
  return 'Hello, World!';
  var foo = 'foo';
}

main();

but no error on this:


function main() {
  return 'Hello, World: ' + bar();

  function bar() {
    console.log(foo);
  }

  var foo = 'foo';
}

main();

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jugglinmikecommented, Oct 7, 2018

This bug was recently reported in different terms, so I’m renaming this issue to make it easier for folks to find.

0reactions
MilesBHuffcommented, Oct 7, 2018

Oh, wow – this has been open for 3 years. Is it going to be as hard to fix now as then, or have refactors since 2015 made things easier?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove unreachable code refactoring - Visual Studio ...
Right-click the code, select the Quick Actions and Refactorings menu and select Remove unreachable code from the Preview window popup. When you' ...
Read more >
c# - Is there a way to get VS2008 to stop warning me about ...
But I am tired of seeing warnings about unreachable code. I'm a person that likes to eliminate all of the warnings, but I...
Read more >
Disabling unreachable code detection partially for the ... - GitHub
I want to disable the unreachable code detection for the condition completeness check. function f(n) { switch(n) { case 0: return 0; ...
Read more >
Warning: unreachable code after return statement - JavaScript
When an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is...
Read more >
C++/CLI: false positive C4702 unreachable code warning ...
Developer Community · declare a ref class with a member variable that is a native pointer. · define a member function of that...
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