Menu

#1 Incorrect instanceof line

1.0
closed
nobody
None
2016-06-20
2014-11-18
No

Javascript Clipper 6.1.3.2 contains the following (unminified) line:

if (!polygon[0] instanceof Array) results = results[0];

The Google Closure Compiler complains about this, and is right: the unary ! binds stronger than the binary instanceof, so this is parsed as

if ((!polygon[0]) instanceof Array) results = results[0];

which will always be false. Other lines are similar but explicitely parenthesized to

if (!(polygon[0] instanceof Array)) results = results[0];

That remaining line should be adjusted accordingly as well.

Discussion

  • Timo Kähkönen

    Timo Kähkönen - 2014-11-19

    Hi, Martin!

    Thanks for opening the first ticket ever!

    You are correct. Fortunately this doesn't affect to core Clipper but only to helper function ClipperLib.JS.Lighten(). (I have no idea why I didn't mention this, because I used Google Closure Compiler for minifying.)

    This will be fixed in next release.

     
  • Martin von Gagern

    This is Closure Compiler version v20140923 if that is of any help to you.

     
  • Timo Kähkönen

    Timo Kähkönen - 2016-06-20

    This is fixed in 6.2.1.0.

     
  • Timo Kähkönen

    Timo Kähkönen - 2016-06-20
    • status: open --> closed
     

Log in to post a comment.