zgrossbart / jslim

It's your favorite JavaScript library, only faster
Apache License 2.0
309 stars 11 forks source link

Moving install/jslim elsewhere and running it results failure #6

Closed paazmaya closed 11 years ago

paazmaya commented 11 years ago

I wanted to copy the build/install/jslim directory closer to my project where I could run it with command

jslim/bin/jslim --js_output_file out.js --js main.js --lib_js jquery.js

But instead I am getting the failure:

java.lang.NullPointerException
        at com.grossbart.jslim.JSlim.getFunctionNames(JSlim.java:1027)
        at com.grossbart.jslim.JSlim.getFunctionNames(JSlim.java:1032)
        at com.grossbart.jslim.JSlim.getFunctionNames(JSlim.java:1032)
        at com.grossbart.jslim.JSlim.findMatchingFunctions(JSlim.java:1122)
        at com.grossbart.jslim.JSlim.findKeepers(JSlim.java:888)
        at com.grossbart.jslim.JSlim.pruneTree(JSlim.java:726)
        at com.grossbart.jslim.JSlim.slim(JSlim.java:281)
        at com.grossbart.jslim.JSlim.addLib(JSlim.java:148)
        at com.grossbart.jslim.JSlim.prune(JSlim.java:180)
        at com.grossbart.jslim.JSlimRunner.prune(JSlimRunner.java:340)
        at com.grossbart.jslim.JSlimRunner.main(JSlimRunner.java:478)
zgrossbart commented 11 years ago

Hi. I'm sorry I didn't see this issue for a while. Are you still having trouble? Any updates?

Thanks, Zack

paazmaya commented 11 years ago

Same thing still occurs.

zgrossbart commented 11 years ago

This error doesn't look like it's related to moving the project. The error indicates that you have an invalid assignment operator in one of your JavaScript files and we're not handling it well. I've made a change in revision e069d29e15fa1dc44fc0474120fe46ee7ea0b057 which should avoid this error and skip this assignment operator. However, this change may cause JSlim to remove a function it should keep because it can't understand the assignment operator.

There's one of two things going on here: either you have some invalid JavaScript where you're assigning a variable to an invalid expression or you have some syntax that JSlim hasn't encountered yet. If you know what the syntax is that's causing the problem I'd be very curious to see it and maybe add a unit test for it.

Thanks, Zack

paazmaya commented 11 years ago

Thank you for the fix. It seems that it is triggered by jQuery, http://code.jquery.com/jquery-2.0.3.js, but cannot say which exact line...