Suppressing or resolving compiler errors in goog.base

萝らか妹 提交于 2019-11-30 23:07:50

So, I decided to go the path with silencing warnings in the base.js. For that I've investigated compiler sources (thanks to the authors it's open source) and I found out that flag description doesn't match its actual effect. The description says:

A file containing warnings to suppress. Each line should be of the form <file-name>:<line-number>? <warning-description>

But in fact this guard intercepts matching errors and converts them into warnings. Moreover, line numbers are completely ignored. I see no use of this flag with such behavior but I bet authors had a good reason to implement it this way.

Anyways, I forked from the main branch and fixed flag's behavior. Now matched errors and warnings are actually suppressed (silenced). Line numbers are now considered in the matching.

Syntax of the whitelist file is very similar to the error/warning output. For example if you get error (or warning) like this:

..\js\google\base.js:120: ERROR - could not determine the type of this expression if (goog.getObjectByName(namespace)) { ^

Then the relevant record in the whitelist file will be:

..\js\google\base.js:120 could not determine the type of this expression

You may add content of multiline errors as comments preceding them with # but only first line will be used for matching.

If this is what you need you may obtain the binary via one of the two ways:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!