Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECMAScript-262 5th Edition "use strict"; directive is incorrectly flagged as no-side-effect code #115

Open
GoogleCodeExporter opened this issue Apr 2, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Open a JavaScript file in the js-ide.
2. Type "use strict"; all on its own line.

What Happens: 
The "use strict"; directive is flagged as no-side-effect code, and 
underlined in the js-ide code-warning color.

What is the expected output? What do you see instead?

ECMAScript-262 5th Edition "use strict"; directive should not be 
incorrectly flagged as no-side-effect code (e.g., it should not be 
underlined and seen as suboptimal by the js-ide rules).

What version of the product are you using? On what operating system?

  js2.el Version: 20080616

  GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 
2008-09-05 on vernadsky, modified by Ubuntu

   uname -a
Linux vr2dev02 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC 2009 
i686 GNU/Linux


Please provide any additional information below.

 Reference: http://www.ecma-international.org/publications/files/ECMA-
ST/ECMA-262.pdf

 From the above specification, note that 'use strict' must appear as a 
single statement only (which js2-mode flags as no-side-effect code):

14.1 Directive Prologues and the Use Strict Directive

A Directive Prologue is the longest sequence of ExpressionStatement 
productions occurring as the initial SourceElement productions of a Program 
or FunctionBody and where each ExpressionStatement in the sequence consists 
entirely of a StringLiteral token followed a semicolon. The semicolon may 
appear explicitly or may be inserted by automatic semicolon insertion. A 
Directive Prologue may be an empty sequence.

A Use Strict Directive is an ExpressionStatement in a Directive Prologue 
whose StringLiteral is either the exact character sequences "use strict" or 
'use strict'. A Use Strict Directive may not contain an EscapeSequence or 
LineContinuation.

A Directive Prologue may contain more than one Use Strict Directive. 
However, an implementation may issue a warning if this occurs.


Thank you.


Original issue reported on code.google.com by [email protected] on 19 Jan 2010 at 7:03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant