sloisel / numeric

Numerical analysis in Javascript

Home Page:http://www.numericjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numeric triggers many syntax warnings in Firefox 40

jwmerrill opened this issue · 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.

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