numeric icon indicating copy to clipboard operation
numeric copied to clipboard

Numeric triggers many syntax warnings in Firefox 40

Open jwmerrill opened this issue 9 years ago • 1 comments

Firefox 40 is currently the alpha/aurora/developer edition release. Loading numeric prints many warnings to the console of the form

SyntaxError: unreachable code after return statement numeric-1.2.6.js:3:54
SyntaxError: unreachable code after return statement numeric-1.2.6.js:5:26
SyntaxError: unreachable code after return statement numeric-1.2.6.js:3:51
SyntaxError: unreachable code after return statement numeric-1.2.6.js:5:31
SyntaxError: unreachable code after return statement numeric-1.2.6.js:3:69
SyntaxError: unreachable code after return statement numeric-1.2.6.js:3:52
SyntaxError: unreachable code after return statement numeric-1.2.6.js:3:86
SyntaxError: unreachable code after return statement numeric-1.2.6.js:5:39
SyntaxError: unreachable code after return statement numeric-1.2.6.js:4:47
SyntaxError: unreachable code after return statement numeric-1.2.6.js:6:39
SyntaxError: unreachable code after return statement numeric-1.2.6.js:4:32

Here's a jsbin that does nothing but include Numeric—you can open it in firefox 40 and check the console.

http://output.jsbin.com/qubolo

These are unfortunately not very easy to debug, because the line and column numbers appear to refer to generated code rather than the actual source of numeric.

jwmerrill avatar Jun 26 '15 23:06 jwmerrill

As read in MDN:

Automatic Semicolon Insertion The return statement is affected by automatic semicolon insertion (ASI). No line terminator is allowed between the return keyword and the expression.

return
a + b;

is transformed by ASI into:

return; 
a + b;

Starting with Gecko 40 the console will warn "unreachable code after return statement".

Link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return

aesedepece avatar Aug 25 '15 22:08 aesedepece