Skip to content
This repository

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

Closed
wants to merge 1 commit into from

2 participants

Rick Waldron Anton Kovalyov
Rick Waldron

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

Rick Waldron 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
Anton Kovalyov
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.

Anton Kovalyov valueof closed this March 22, 2013
Rick Waldron

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

Showing 1 unique commit by 1 author.

Mar 18, 2013
Rick Waldron 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
This page is out of date. Refresh to see the latest.
30  src/stable/jshint.js
@@ -3575,37 +3575,25 @@ var JSHINT = (function () {
3575 3575
 		return this;
3576 3576
 	}).exps = true;
3577 3577
 
3578  
-	// Future Reserved Words
3579  
-
3580  
-	FutureReservedWord("abstract");
3581  
-	FutureReservedWord("boolean");
3582  
-	FutureReservedWord("byte");
3583  
-	FutureReservedWord("char");
  3578
+	// ES-262, 5.1 - 7.6.1.2 Future Reserved Words
3584 3579
 	FutureReservedWord("class", { es5: true });
3585  
-	FutureReservedWord("double");
  3580
+	// FutureReservedWord("const", { es5: true });
3586 3581
 	FutureReservedWord("enum", { es5: true });
3587 3582
 	FutureReservedWord("export", { es5: true });
3588 3583
 	FutureReservedWord("extends", { es5: true });
3589  
-	FutureReservedWord("final");
3590  
-	FutureReservedWord("float");
3591  
-	FutureReservedWord("goto");
3592  
-	FutureReservedWord("implements", { es5: true, strictOnly: true });
3593 3584
 	FutureReservedWord("import", { es5: true });
3594  
-	FutureReservedWord("int");
3595  
-	FutureReservedWord("interface");
3596  
-	FutureReservedWord("long");
3597  
-	FutureReservedWord("native");
  3585
+	FutureReservedWord("super", { es5: true });
  3586
+
  3587
+	// ES-262, 5.1 - 7.6.1.2 Future Reserved Words, Strict Mode Only
  3588
+	FutureReservedWord("implements", { es5: true, strictOnly: true });
  3589
+	FutureReservedWord("interface", { es5: true, strictOnly: true });
  3590
+	// FutureReservedWord("let", { es5: true, strictOnly: true });
3598 3591
 	FutureReservedWord("package", { es5: true, strictOnly: true });
3599 3592
 	FutureReservedWord("private", { es5: true, strictOnly: true });
3600 3593
 	FutureReservedWord("protected", { es5: true, strictOnly: true });
3601 3594
 	FutureReservedWord("public", { es5: true, strictOnly: true });
3602  
-	FutureReservedWord("short");
3603 3595
 	FutureReservedWord("static", { es5: true, strictOnly: true });
3604  
-	FutureReservedWord("super", { es5: true });
3605  
-	FutureReservedWord("synchronized");
3606  
-	FutureReservedWord("throws");
3607  
-	FutureReservedWord("transient");
3608  
-	FutureReservedWord("volatile");
  3596
+	// FutureReservedWord("yield", { es5: true, strictOnly: true });
3609 3597
 
3610 3598
 	// this function is used to determine wether a squarebracket or a curlybracket
3611 3599
 	// expression is a comprehension array, destructuring assignment or a json value.
1  tests/stable/unit/core.js
@@ -526,7 +526,6 @@ exports.testReserved = function (test) {
526 526
 	var src = fs.readFileSync(__dirname + "/fixtures/reserved.js", "utf8");
527 527
 
528 528
 	TestRun(test)
529  
-		.addError(1, "Expected an identifier and instead saw 'volatile' (a reserved word).")
530 529
 		.addError(5, "Expected an identifier and instead saw 'let' (a reserved word).")
531 530
 		.addError(10, "Expected an identifier and instead saw 'let' (a reserved word).")
532 531
 		.addError(14, "Expected an identifier and instead saw 'else' (a reserved word).")
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.