kangax/fabric.js — pull request #465 by atis-- (2013-03-08 17:59:05+00:00)
Title: Closure Compiler dies on divide by zero

Closure Compiler dies before producing usable output (all.min.js has zero size). This is caused by a floating point infinity check within src/util/lang_array.js source file. I have pasted the compiler's complete warning/error output below. The relevant lines are at the very bottom (not sure if the warnings have any actual meaning).

The suggested fix is according to a googled stackoverflow question here:
http://stackoverflow.com/questions/4724555/how-do-i-check-if-a-number-evaluates-to-infinity

$ java -jar lib/google_closure_compiler.jar --js dist/all.js

dist/all.js:135: WARNING - Parse error. missing opening (
*/
^

dist/all.js:135: WARNING - Parse error. Unexpected end of file
*/
^

dist/all.js:142: WARNING - Parse error. missing opening (
*/
^

dist/all.js:142: WARNING - Parse error. Unexpected end of file
*/
^

dist/all.js:149: WARNING - Parse error. missing opening (
*/
^

dist/all.js:149: WARNING - Parse error. Unexpected end of file
*/
^

dist/all.js:224: WARNING - Parse error. duplicate variable name "The"
* @param {fabric.Point} The origin of the rotation
^

dist/all.js:225: WARNING - Parse error. duplicate variable name "The"
* @param {Number} The radians of the angle for the rotation
^

dist/all.js:915: WARNING - Parse error. expected closing }
* @param {Any[]} [...] Values to pass to a bound function
^

dist/all.js:915: WARNING - Parse error. expecting a variable name in a @param tag
* @param {Any[]} [...] Values to pass to a bound function
^

dist/all.js:3254: WARNING - Parse error. expecting a variable name in a @param tag
* @param [...] Zero or more fabric instances
^

dist/all.js:5356: WARNING - Parse error. duplicate variable name "enum"
* @param {string} enum('top', 'center', 'bottom') Vertical origin
^

dist/all.js:5385: WARNING - Parse error. duplicate variable name "enum"
* @param {string} enum('top', 'center', 'bottom') Vertical origin
^

dist/all.js:5428: WARNING - Parse error. duplicate variable name "enum"

dist/all.js:5491: WARNING - Parse error. duplicate variable name "enum"
/**

dist/all.js:7266: WARNING - Suspicious code. Is there a missing '+' on the previous line?
"use strict";
^

dist/all.js:8362: WARNING - Parse error. type annotation incompatible with other annotations
* @type Object
^

dist/all.js:582: ERROR - Divide by 0
else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
^

dist/all.js:582: ERROR - Divide by 0
else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
^

2 error(s), 17 warning(s)