wcandillon/xqlint

Warning when minifying xqlint.js

Opened this issue · 1 comments

In updating eXide to use the current xqlint (see the work-in-progress PR at wolfgangmm/eXide#141), I stumbled upon an "unreachable code" warning reported by the Google Closure compiler. I'm not sure if this is a real problem or not?

$ ant 
Buildfile: /Users/joe/workspace/hsg-project/repos/eXide/build.xml

xqlint:
     [echo] Optimizing xqlint ...
     [exec] npm WARN package.json xqlint@0.3.3 No license field.
     [exec] Running "browserify:browser_build" (browserify) task
     [exec] 
     [exec] Done, without errors.

check-closure-available:

get-closure:

prepare:

compress:
     [echo] Optimizing eXide sources
   [jscomp] None of the files changed. Compilation skipped.
   [jscomp] None of the files changed. Compilation skipped.
   [jscomp] Compiling 3 file(s) with 65 extern(s)
   [jscomp] support/xqlint/build/xqlint.js:1712: WARNING - unreachable code
   [jscomp]                     if(mod !== 0 && false) {
   [jscomp]                                            ^
   [jscomp] 0 error(s), 1 warning(s)

xar:
     [copy] Copying 1 file to /Users/joe/workspace/hsg-project/repos/eXide
     [copy] Copying 1 file to /Users/joe/workspace/hsg-project/repos/eXide
      [zip] Building zip: /Users/joe/workspace/hsg-project/repos/eXide/build/eXide-2.2.0.xar

all:

BUILD SUCCESSFUL
Total time: 18 seconds

Despite the "unreachable code" warning, the build does seem to succeed.

Background: eXide used to use rhino and r.js to compile xqlint, but since xqlint now uses grunt, I figured I should move eXide's build steps to grunt. I succeeded with that, but next I need to be able to merge and minify the three .js files in xqlint's build directory, which are produced by the browserify:browser_build grunt task, so I can then reference in eXide as "xqlint.min.js." I actually tried using grunt's uglify task to perform this, but failed at this. eXide already uses Closure for compressing other libraries, so I figured I would use it.

I'm not sure if this warning has any significance, but I thought it best to report the problem.

@joewiz Just static checks should ignore the generated parser files. Can you disable these checks for the generated files? (XQueryParser.js and so on).