sloisel / numeric

Numerical analysis in Javascript
http://www.numericjs.com/
Other
1.42k stars 176 forks source link

Numeric triggers many syntax warnings in Firefox 40 #65

Open jwmerrill opened 9 years ago

jwmerrill commented 9 years ago

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.

aesedepece commented 8 years ago

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