GNOME Bugzilla – Bug 734569
Add option to disable extra warnings
Last modified: 2014-08-13 07:10:18 UTC
Extra warnings are an optional flag you can set on the MozJs engine. They generate a fair amount of warning with code generated from the CoffeeScript compiler like these : 'function anonymous does not always return a value' 'test for equality (==) mistyped as assignment (=)?' 'variable path redeclares argument' All of these are important messages you want see if you're writing JavaScript code, but less so when you're writing code that gets compiled to JavaScript. In this case you probably rely on the compiler to do the right thing (tm). Here is a patch to opt out of extra warnings.
Created attachment 283023 [details] [review] console: add --no-extra-warnings option
Review of attachment 283023 [details] [review]: I think in general an environment variable is better for this; easier to handle for developers locally. Similar to G_DEBUG_MESSAGES=all etc. Presumably though at least some of these are things the coffeescript people could easily fix.
I agree with you on fixing the CoffeeScript compiler, but that turns out to be a pretty tricky thing to do. CoffeeScript tries to look like a functional language, return automatically the last expression/statement. As a result most developers don't really bother putting an empty "return" statement at the end of their functions. I will rework the patch to make it a environment variable.
Created attachment 283129 [details] [review] context: add GJS_DISABLE_EXTRA_WARNING env variable to disable mozjs' extra warnings
Review of attachment 283129 [details] [review]: Looks fine to me.
Thanks!