mihaip / react-closure-compiler

Tooling to teach Closure Compiler about React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update for Plovr 4.0

mihaip opened this issue · comments

JsDocInfoBuilder's build() signature has changed, among other API changes.

@mihaip What version of plovr do you recommend? It seems that https://github.com/bolinfest/plovr/releases/tag/v3.0.0 produces way too much warnings, maybe due to plovr warning WARNING: UNUSED OPTION "custom-warnings-guards".
Thanks.

3.1 should work, it was cut after my commit that added support for custom warnings guards (bolinfest/plovr@5ec1984).

Hi, @mihaip

We have successfully gotten your react custom pass working with the latest plovr (v4) with these updates. Admittedly, we are just experimenting with React at the moment, so we don't have a lot of code that is testing your custom compiler pass.

In the commit message, I've listed the closure-library commits that made these updates necessary.

I would very much like to contribute these changes via pull request, but I have noted that with the latest release of the closure-compiler, two of your helpful unit tests are failing after these updates.

One the failures seem to be happening because the Closure Compiler has gotten more precise in error checking for inexistent properties.

    [junit] Testcase: testMethodJsDoc took 0.112 sec
    [junit]     FAILED
    [junit] Did not find expected error JSC_INEXISTENT_PROPERTY: , instead found
             JSC_POSSIBLE_INEXISTENT_PROPERTY. Property notAMethod never defined 
             on numberParam at /src/test.js line 1 : 167

I'm not really sure what's going on with the second failure:

   [junit]  FAILED
    [junit] Expected failure, instead got output: // Input 0
    [junit] window.$React$=function($f$$){return{$createClass$:$f$$(),$createElement$:$f$$(),$cloneElement$:$f$$(),$createFactory$:$f$$(),$createMixin$:function($f$$){return $f$$},$render$:$f$$(),$setState$:$f$$()}}(function(){});
    [junit] // Input 1
    [junit] React.$render$(React.$createElement$(React.$createClass$({$mixins$:[{$mixinMethod$:function(){window.$foo$=123}}],$render$:function(){this.$mixinMethod$("notanumber");return React.$createElement$("div")}})),document.body).$mixinMethod$("notanumber");
    [junit] junit.framework.AssertionFailedError: Expected failure, instead got output: // Input 0
    [junit] window.$React$=function($f$$){return{$createClass$:$f$$(),$createElement$:$f$$(),$cloneElement$:$f$$(),$createFactory$:$f$$(),$createMixin$:function($f$$){return $f$$},$render$:$f$$(),$setState$:$f$$()}}(function(){});
    [junit] // Input 1
    [junit] React.$render$(React.$createElement$(React.$createClass$({$mixins$:[{$mixinMethod$:function(){window.$foo$=123}}],$render$:function(){this.$mixinMethod$("notanumber");return React.$createElement$("div")}})),document.body).$mixinMethod$("notanumber");
    [junit]     at info.persistent.react.jscomp.ReactCompilerPassTest.test(ReactCompilerPassTest.java:814)
    [junit]     at info.persistent.react.jscomp.ReactCompilerPassTest.testError(ReactCompilerPassTest.java:748)
    [junit]     at info.persistent.react.jscomp.ReactCompilerPassTest.testMixins(ReactCompilerPassTest.java:165)

If would be super if you might consider checking out my fork to see if you might have any insight into why these unit tests are failing after these updates.

BTW, I have a forked plovr that includes several enhancements that may or (may not interest you).

Thanks in advance.
Rick