-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[FIX]] Correct restriction on function name
The ECMAScript specification details the following early error for function-defining productions: > - If the source code matching this production is strict mode code, it > is a Syntax Error if BindingIdentifier is present and the > StringValue of BindingIdentifier is "eval" or "arguments". There were two bugs in the original implementation of this error: - violations from function expressions with empty bodies would not be detected - violations from function declarations contained within strict mode code would be reported twice Correct the first issue by ensuring that the "(isStrict)" property is accurately set for functions with empty bodies. Correct the second issue by re-locating the error detection logic to within the processing logic for expressions and declarations and inserting an additional condition within the latter. (This correction does not require modification to the Test262 whitelist file, although that test suite does offer coverage for this behavior. At the revision in use by JSHint, the relevant tests are expressed using `eval` and therefore unusable by parsers. Those tests have since been reformatted to correct this; they will be incorporated when JSHint next updates its reference to Test262.)
- Loading branch information
1 parent
ff71d3c
commit 55aa54e
Showing
2 changed files
with
67 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters