Google 闭包编译器不报告被零除

Google closure compiler does not report divide-by-zero

我有 运行 google 下一个闭包编译器:

alert(1 / 0);

使用命令:

java -jar node_modules\google-closure-compiler\compiler.jar --warning_level=VERBOSE test.js 

并且它没有报告任何内容。我预计它会说一些关于除零的事情,因为参考文献(https://developers.google.com/closure/compiler/docs/error-ref)提到了关于

JSC_DIVIDE_BY_0_ERROR:

Divide by 0

This error means that you an arithmetical division expression with a denominator of 0. Dividing by zero at runtime produces a runtime error.

我还测试了 JSC_BITWISE_OPERAND_OUT_OF_RANGE:

的示例代码
var y = 1024 * 1024 * 1024 * 2 >> 2;

在这种情况下,google 闭包编译器准确指出了问题。

test.js:2: WARNING - Operand out of range, bitwise operation will lose information: NUMBER 2.147483648E9 2 [length: 22] [source_file: test.js]
var y = 1024 * 1024 * 1024 * 2 >> 2;
        ^

如何获得顶级源代码JSC_DIVIDE_BY_0_ERROR

JSC_DIVIDE_BY_0_ERROR错误在编译器源代码中已经不存在了,您可以在https://github.com/google/closure-compiler中搜索。因此,错误检查必须已被删除。

Closure Compiler 文档目前有点过时并且分散在各个页面中。