Loading ...
Sorry, an error occurred while loading the content.

2006Re: /*jslint is seen as a reserved word

Expand Messages
  • abyssoft@ymail.com
    Mar 4, 2011
    • 0 Attachment
      Neither of those are lexically correct
      however

      /*jslint bitwise: false*/ // allow bitwise operators
      function twiddle(a, b) {
      return a & b;
      }
      /*jslint bitwise: true*/ // disallow bitwise operators for rest of file

      --- In jslint_com@yahoogroups.com, Joshua Bell <josh@...> wrote:
      >
      > On Fri, Mar 4, 2011 at 8:29 AM, Douglas Crockford <douglas@...>
      > wrote:
      > >
      > >
      > > No it shouldn't. JSLint allows those directives at statement position only.
      > >
      >
      > Does the jslint directive apply within a lexical scope, or does it function
      > like a pre-processor directive irrespective of lexical structure?
      >
      > i.e. which should be used:
      >
      > function twiddle(a, b) {
      > /*jslint bitwise: false*/ // allow bitwise operators for this lexical
      > scope
      > return a & b;
      > }
      > // bitwise option implicitly back to default for rest of file
      >
      > or:
      >
      > function twiddle(a, b) {
      > /*jslint bitwise: false*/ // allow bitwise operators
      > return a & b;
      > /*jslint bitwise: true*/ // disallow bitwise operators for rest of file
      > }
      >
      > I had been assuming the latter, but I'd be quite happy if it were the
      > former.
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • Show all 8 messages in this topic