Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes #936. "volatile" is not a reserved word (among many) #937

Closed
wants to merge 1 commit into from

2 participants

@rwaldron
Owner

Removes erroneously listed "future reserved words" and puts the correct lists in order and marked under the section of ES5 that they are defined.

const, let and yield are commented out until a proper mechanism for flipping them from FutureReservedWord (ES5) to Keyword (ES6/moz) is established

Signed-off-by: Rick Waldron waldron.rick@gmail.com

@rwaldron rwaldron Fixes #936. "volatile" is not a reserved word (among many)
Removes erroneously listed "future reserved words" and puts the correct lists in order and marked under the section of ES5 that they are defined.

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
fcbd98f
@valueof
Owner

These are reserved words in ES3. By default JSHint assumes the ES3 environment but you can't opt into ES5 by using es5 flag. Hence the FutureReservedWord('bla', { es5: true }) on some of them. For example:

var volatile = 1; // Expected an identifier and instead saw 'volatile' (a reserved word).

But

/*jshint es5:true */
var volatile = 1; // No error

At some point we'll make ES5 the default and ES3 opt-in. But that's for a major release. Closing this PR but feel free to comment if you disagree—reopening is easy.

@valueof valueof closed this
@rwaldron
Owner

I'm guess that this was the motivation for #951 makes sense to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 18, 2013
  1. @rwaldron

    Fixes #936. "volatile" is not a reserved word (among many)

    rwaldron authored
    Removes erroneously listed "future reserved words" and puts the correct lists in order and marked under the section of ES5 that they are defined.
    
    Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 22 deletions.
  1. +9 −21 src/stable/jshint.js
  2. +0 −1  tests/stable/unit/core.js
View
30 src/stable/jshint.js
@@ -3575,37 +3575,25 @@ var JSHINT = (function () {
return this;
}).exps = true;
- // Future Reserved Words
-
- FutureReservedWord("abstract");
- FutureReservedWord("boolean");
- FutureReservedWord("byte");
- FutureReservedWord("char");
+ // ES-262, 5.1 - 7.6.1.2 Future Reserved Words
FutureReservedWord("class", { es5: true });
- FutureReservedWord("double");
+ // FutureReservedWord("const", { es5: true });
FutureReservedWord("enum", { es5: true });
FutureReservedWord("export", { es5: true });
FutureReservedWord("extends", { es5: true });
- FutureReservedWord("final");
- FutureReservedWord("float");
- FutureReservedWord("goto");
- FutureReservedWord("implements", { es5: true, strictOnly: true });
FutureReservedWord("import", { es5: true });
- FutureReservedWord("int");
- FutureReservedWord("interface");
- FutureReservedWord("long");
- FutureReservedWord("native");
+ FutureReservedWord("super", { es5: true });
+
+ // ES-262, 5.1 - 7.6.1.2 Future Reserved Words, Strict Mode Only
+ FutureReservedWord("implements", { es5: true, strictOnly: true });
+ FutureReservedWord("interface", { es5: true, strictOnly: true });
+ // FutureReservedWord("let", { es5: true, strictOnly: true });
FutureReservedWord("package", { es5: true, strictOnly: true });
FutureReservedWord("private", { es5: true, strictOnly: true });
FutureReservedWord("protected", { es5: true, strictOnly: true });
FutureReservedWord("public", { es5: true, strictOnly: true });
- FutureReservedWord("short");
FutureReservedWord("static", { es5: true, strictOnly: true });
- FutureReservedWord("super", { es5: true });
- FutureReservedWord("synchronized");
- FutureReservedWord("throws");
- FutureReservedWord("transient");
- FutureReservedWord("volatile");
+ // FutureReservedWord("yield", { es5: true, strictOnly: true });
// this function is used to determine wether a squarebracket or a curlybracket
// expression is a comprehension array, destructuring assignment or a json value.
View
1  tests/stable/unit/core.js
@@ -526,7 +526,6 @@ exports.testReserved = function (test) {
var src = fs.readFileSync(__dirname + "/fixtures/reserved.js", "utf8");
TestRun(test)
- .addError(1, "Expected an identifier and instead saw 'volatile' (a reserved word).")
.addError(5, "Expected an identifier and instead saw 'let' (a reserved word).")
.addError(10, "Expected an identifier and instead saw 'let' (a reserved word).")
.addError(14, "Expected an identifier and instead saw 'else' (a reserved word).")
Something went wrong with that request. Please try again.