Title: [239354] trunk
Revision
239354
Author
[email protected]
Date
2018-12-18 14:14:20 -0800 (Tue, 18 Dec 2018)

Log Message

Redeclaration of var over let/const/class should be a syntax error.
https://bugs.webkit.org/show_bug.cgi?id=192298

Reviewed by Keith Miller.

JSTests:

* test262.yaml:
* test262/expectations.yaml:
Mark 46 tests as passing.

* stress/block-scope-redeclarations.js:
Add some new tests.

* stress/for-in-invalidate-context-weird-assignments.js:
* stress/for-in-tests.js:
Replace tests for outdated behavior with tests for SyntaxError.

* ChakraCore/test/LetConst/defer3.baseline-jsc:
* ChakraCore/test/LetConst/letvar.baseline-jsc:
Update expectations.

Source/_javascript_Core:

>From https://tc39.github.io/ecma262/#sec-block-static-semantics-early-errors:
It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList also occurs in the
VarDeclaredNames of StatementList.

Accordingly, this patch ensures that { let x; { var x; } } and { { var x; } let x; } are syntax errors.

For the "var after" scenario:
When checking for existing lexically-declared names, we can't simply check the current var scope;
we need to check *all* enclosing scopes up to (and including) the current var scope. In so doing,
we must also avoid violating the Annex B.3.5 condition that allows `try {} catch (e) { var e; }`.

For the "var before" scenario:
We ensure that lexical scopes always keep track of the vars being hoisted over them; this gives us
a simple way to check the current block's var-declared names prior to making a lexical declaration.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseTryStatement):
* parser/Parser.h:
(JSC::Scope::Scope):
(JSC::Scope::setIsSimpleCatchParameterScope): Added.
(JSC::Scope::isSimpleCatchParameterScope): Added.
(JSC::Scope::declareVariable):
(JSC::Scope::addVariableBeingHoisted): Added.
(JSC::Scope::declareLexicalVariable):
(JSC::Scope::hasDeclaredVariable):
(JSC::Scope::hasLexicallyDeclaredVariable): Added.
(JSC::Parser::declareHoistedVariable): Added.
(JSC::Parser::declareVariable):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChakraCore/test/LetConst/defer3.baseline-jsc (239353 => 239354)


--- trunk/JSTests/ChakraCore/test/LetConst/defer3.baseline-jsc	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/JSTests/ChakraCore/test/LetConst/defer3.baseline-jsc	2018-12-18 22:14:20 UTC (rev 239354)
@@ -28,11 +28,11 @@
 SyntaxError: Cannot declare a let variable twice: 'x'.
 SyntaxError: Cannot declare a var variable that shadows a let/const/class variable: 'x'.
 SyntaxError: Cannot declare a var variable that shadows a let/const/class variable: 'x'.
-Syntax check succeeded
-Syntax check succeeded
-Syntax check succeeded
-Syntax check succeeded
 SyntaxError: Cannot declare a const variable twice: 'x'.
 SyntaxError: Cannot declare a let variable twice: 'x'.
 SyntaxError: Cannot declare a var variable that shadows a let/const/class variable: 'x'.
 SyntaxError: Cannot declare a var variable that shadows a let/const/class variable: 'x'.
+SyntaxError: Cannot declare a const variable twice: 'x'.
+SyntaxError: Cannot declare a let variable twice: 'x'.
+SyntaxError: Cannot declare a var variable that shadows a let/const/class variable: 'x'.
+SyntaxError: Cannot declare a var variable that shadows a let/const/class variable: 'x'.

Modified: trunk/JSTests/ChakraCore/test/LetConst/letvar.baseline-jsc (239353 => 239354)


--- trunk/JSTests/ChakraCore/test/LetConst/letvar.baseline-jsc	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/JSTests/ChakraCore/test/LetConst/letvar.baseline-jsc	2018-12-18 22:14:20 UTC (rev 239354)
@@ -1,8 +1,3 @@
 SyntaxError: Cannot declare a var variable that shadows a let/const/class variable: 'x'.
-var x
-undefined
-let y
-var y
-undefined
-let x
-undefined
+SyntaxError: Cannot declare a var variable that shadows a let/const/class variable: 'x'.
+SyntaxError: Cannot declare a let variable twice: 'x'.

Modified: trunk/JSTests/ChangeLog (239353 => 239354)


--- trunk/JSTests/ChangeLog	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/JSTests/ChangeLog	2018-12-18 22:14:20 UTC (rev 239354)
@@ -1,3 +1,25 @@
+2018-12-18  Ross Kirsling  <[email protected]>
+
+        Redeclaration of var over let/const/class should be a syntax error.
+        https://bugs.webkit.org/show_bug.cgi?id=192298
+
+        Reviewed by Keith Miller.
+
+        * test262.yaml:
+        * test262/expectations.yaml:
+        Mark 46 tests as passing.
+
+        * stress/block-scope-redeclarations.js:
+        Add some new tests.
+
+        * stress/for-in-invalidate-context-weird-assignments.js:
+        * stress/for-in-tests.js:
+        Replace tests for outdated behavior with tests for SyntaxError.
+
+        * ChakraCore/test/LetConst/defer3.baseline-jsc:
+        * ChakraCore/test/LetConst/letvar.baseline-jsc:
+        Update expectations.
+
 2018-12-18  Mark Lam  <[email protected]>
 
         Skip the stress/elidable-new-object-roflcopter-then-exit.js test on 32-bit.

Added: trunk/JSTests/stress/block-scope-redeclarations.js (0 => 239354)


--- trunk/JSTests/stress/block-scope-redeclarations.js	                        (rev 0)
+++ trunk/JSTests/stress/block-scope-redeclarations.js	2018-12-18 22:14:20 UTC (rev 239354)
@@ -0,0 +1,39 @@
+function shouldNotThrow(script) {
+  eval(script);
+}
+
+function shouldThrowSyntaxError(script) {
+    let error;
+    try {
+        eval(script);
+    } catch (e) {
+        error = e;
+    }
+
+    if (!(error instanceof SyntaxError))
+        throw new Error('Expected SyntaxError!');
+}
+
+shouldThrowSyntaxError('{ var x; let x; }');
+shouldThrowSyntaxError('{ { var x; } let x; }');
+shouldThrowSyntaxError('{ { { var x; } } let x; }');
+shouldThrowSyntaxError('{ let x; var x; }');
+shouldThrowSyntaxError('{ let x; { var x; } }');
+shouldThrowSyntaxError('{ let x; { { var x; } } }');
+
+shouldNotThrow('{ var x; { let x; } }');
+shouldNotThrow('{ var x; { { let x; } } }');
+shouldNotThrow('{ { let x; } var x; }');
+shouldNotThrow('{ { { let x; } } var x; }');
+
+shouldThrowSyntaxError('{ var x; const x = 0; }');
+shouldThrowSyntaxError('{ { var x; } const x = 0; }');
+shouldThrowSyntaxError('{ { { var x; } } const x = 0; }');
+shouldThrowSyntaxError('{ const x = 0; var x; }');
+shouldThrowSyntaxError('{ const x = 0; { var x; } }');
+shouldThrowSyntaxError('{ const x = 0; { { var x; } } }');
+
+shouldNotThrow('{ var x; { const x = 0; } }');
+shouldNotThrow('{ var x; { { const x = 0; } } }');
+shouldNotThrow('{ { const x = 0; } var x; }');
+shouldNotThrow('{ { { const x = 0; } } var x; }');

Modified: trunk/JSTests/stress/for-in-invalidate-context-weird-assignments.js (239353 => 239354)


--- trunk/JSTests/stress/for-in-invalidate-context-weird-assignments.js	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/JSTests/stress/for-in-invalidate-context-weird-assignments.js	2018-12-18 22:14:20 UTC (rev 239354)
@@ -9,6 +9,18 @@
         f();
 }
 
+function shouldThrowSyntaxError(script) {
+    let error;
+    try {
+        eval(script);
+    } catch (e) {
+        error = e;
+    }
+
+    if (!(error instanceof SyntaxError))
+        throw new Error('Expected SyntaxError!');
+}
+
 test(function() {
     let o = {xx: 0};
     for (let i in o) {
@@ -21,15 +33,6 @@
 test(function() {
     let o = {xx: 0};
     for (let i in o) {
-        for (var i of [0]) { }
-        assert(typeof i === "number");
-        assert(o[i] === undefined);
-    }
-});
-
-test(function() {
-    let o = {xx: 0};
-    for (let i in o) {
         for ({i} of [{i: 0}]) { }
         assert(typeof i === "number");
         assert(o[i] === undefined);
@@ -72,11 +75,20 @@
     }
 });
 
-test(function() {
-    let o = {xx: 0};
-    for (let i in o) {
-        var i = 0;
-        assert(typeof i === "number");
-        assert(o[i] === undefined);
-    }
-});
+shouldThrowSyntaxError(
+    `function f() {
+        let o = {xx: 0};
+        for (let i in o) {
+            for (var i of [0]) { }
+        }
+    }`
+);
+
+shouldThrowSyntaxError(
+    `function f() {
+        let o = {xx: 0};
+        for (let i in o) {
+            var i = 0;
+        }
+    }`
+);

Modified: trunk/JSTests/stress/for-in-tests.js (239353 => 239354)


--- trunk/JSTests/stress/for-in-tests.js	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/JSTests/stress/for-in-tests.js	2018-12-18 22:14:20 UTC (rev 239354)
@@ -1,3 +1,15 @@
+function shouldThrowSyntaxError(script) {
+    let error;
+    try {
+        eval(script);
+    } catch (e) {
+        error = e;
+    }
+
+    if (!(error instanceof SyntaxError))
+        throw new Error('Expected SyntaxError!');
+}
+
 (function() {
     // Iterate over an array with normal indexed properties.
     var foo = function() {
@@ -149,30 +161,14 @@
     }
 })();
 
-(function() {
-    var foo = function(a, b, first) {
-        {   
+shouldThrowSyntaxError(
+    `function foo(a, b) {
+        {
             let p = 'some-value';
             for (var p = b in a) {}
-            if (first)
-                return p;
         }
-        return p;
-    };
-    noInline(foo);
-    for (var i = 0; i < 10000; ++i) {
-        var expected = 'expected-result';
-        var result = foo({}, expected, true);
-        if (expected !== result)
-            throw new Error("bad result: " + result + "!==" + expected);
-    }
-    for (var i = 0; i < 10000; ++i) {
-        var expected = 'expected-result';
-        var result = foo({}, expected, false);
-        if (typeof result !== 'undefined')
-            throw new Error("bad result: " + result + "!== undefined");
-    }
-})();
+    }`
+);
 
 (function() {
     var foo = function(a, b, c) {
@@ -188,24 +184,16 @@
     }
 })();
 
-(function() {
-    var error = false;
-    try {
-        eval("(function() { 'use strict'; for (var i = 0 in {}) {}})()");
-    } catch(e) {
-        error = e instanceof SyntaxError;
-    }
-    if (!error)
-        throw new Error("Expected SyntaxError error");
-})();
+shouldThrowSyntaxError(
+    `function foo() {
+        'use strict';
+        for (var i = 0 in {}) {}
+    }`
+);
 
-(function() {
-    var error = false;
-    try {
-        eval("(function() { const i = 10; for (var i = 0 in {}) {}})()");
-    } catch(e) {
-        error = e instanceof SyntaxError;
-    }
-    if (!error)
-        throw new Error("Expected SyntaxError error");
-})();
+shouldThrowSyntaxError(
+    `function foo() {
+        const i = 10;
+        for (var i = 0 in {}) {}
+    }`
+);

Modified: trunk/JSTests/test262/expectations.yaml (239353 => 239354)


--- trunk/JSTests/test262/expectations.yaml	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/JSTests/test262/expectations.yaml	2018-12-18 22:14:20 UTC (rev 239354)
@@ -1765,7 +1765,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js:
@@ -1772,9 +1771,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-function-declaration.js:
@@ -1781,9 +1777,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-generator-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-var-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js:
@@ -1794,12 +1787,8 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-let-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js:
@@ -1814,7 +1803,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-function-declaration.js:
@@ -1821,18 +1809,9 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-generator-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-var-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
-test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
-test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-const-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
@@ -1839,9 +1818,6 @@
 test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
-test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-let-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/computed-property-names/class/static/method-number.js:
   default: "Test262Error: `compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'a', 'c', 'name'])` returns `true`"
   strict mode: "Test262Error: `compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'a', 'c', 'name'])` returns `true`"
@@ -3416,8 +3392,6 @@
 test/language/statements/class/super-fielddefinition-initializer-abrupt-completion.js:
   default: "SyntaxError: Unexpected token '='. Expected an opening '(' before a method's parameter list."
   strict mode: "SyntaxError: Unexpected token '='. Expected an opening '(' before a method's parameter list."
-test/language/statements/const/redeclaration-error-from-within-strict-mode-function-const.js:
-  default: 'Test262: This statement should not be evaluated.'
 test/language/statements/do-while/let-array-with-newline.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/for-in/12.6.4-2.js:
@@ -3463,12 +3437,6 @@
 test/language/statements/for-in/dstr-obj-rest-not-last-element-invalid.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
-test/language/statements/for-in/head-const-bound-names-in-stmt.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
-test/language/statements/for-in/head-let-bound-names-in-stmt.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
@@ -3605,9 +3573,6 @@
 test/language/statements/for-of/dstr-obj-rest-not-last-element-invalid.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
-test/language/statements/for-of/head-const-bound-names-in-stmt.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/for-of/head-decl-no-expr.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
@@ -3614,9 +3579,6 @@
 test/language/statements/for-of/head-expr-no-expr.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
-test/language/statements/for-of/head-let-bound-names-in-stmt.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
@@ -3634,9 +3596,6 @@
   strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/for-of/let-array-with-newline.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/statements/for/head-let-bound-names-in-stmt.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/for/head-lhs-let.js:
   default: "SyntaxError: Unexpected token ';'. Expected a parameter pattern or a ')' in parameter list."
 test/language/statements/for/let-array-with-newline.js:
@@ -3700,13 +3659,8 @@
   strict mode: "SyntaxError: Cannot use 'yield' as a label in strict mode."
 test/language/statements/let/block-local-closure-set-before-initialization.js:
   default: 'Test262Error: Expected a ReferenceError to be thrown but no exception was thrown at all'
-test/language/statements/let/redeclaration-error-from-within-strict-mode-function.js:
-  default: 'Test262: This statement should not be evaluated.'
 test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-var.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/let/syntax/escaped-let.js:
   default: "SyntaxError: Unexpected escaped characters in keyword token: 'l\\u0065t'"
 test/language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js:
@@ -3723,7 +3677,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js:
@@ -3730,9 +3683,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-function-declaration.js:
@@ -3739,9 +3689,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-generator-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-var-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js:
@@ -3754,7 +3701,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js:
@@ -3769,7 +3715,6 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-function-declaration.js:
@@ -3776,18 +3721,9 @@
   default: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-generator-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
-test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-var-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
-test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
-test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-const-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
@@ -3794,9 +3730,6 @@
 test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'
-test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-let-declaration.js:
-  default: 'Test262: This statement should not be evaluated.'
-  strict mode: 'Test262: This statement should not be evaluated.'
 test/language/statements/try/early-catch-function.js:
   default: 'Test262: This statement should not be evaluated.'
   strict mode: 'Test262: This statement should not be evaluated.'

Modified: trunk/JSTests/test262.yaml (239353 => 239354)


--- trunk/JSTests/test262.yaml	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/JSTests/test262.yaml	2018-12-18 22:14:20 UTC (rev 239354)
@@ -62362,7 +62362,7 @@
 - path: test262/test/language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -62424,9 +62424,9 @@
 - path: test262/test/language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -62456,9 +62456,9 @@
 - path: test262/test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-let-declaration.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -62488,7 +62488,7 @@
 - path: test262/test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -62520,7 +62520,7 @@
 - path: test262/test/language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -62550,9 +62550,9 @@
 - path: test262/test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-let-declaration.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -62562,13 +62562,13 @@
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-const-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-const-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js
@@ -62578,9 +62578,9 @@
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-let-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-let-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-var-declaration.js
   cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-var-declaration.js
@@ -101346,7 +101346,7 @@
 - path: test262/test/language/statements/const/global-use-before-initialization-in-prior-statement.js
   cmd: runTest262 :normal, "ReferenceError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/const/redeclaration-error-from-within-strict-mode-function-const.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js
@@ -103104,9 +103104,9 @@
 - path: test262/test/language/statements/for/head-const-fresh-binding-per-iteration.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for/head-let-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for/head-let-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for/head-let-destructuring.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for/head-let-destructuring.js
@@ -108164,9 +108164,9 @@
 - path: test262/test/language/statements/for-in/head-const-bound-names-fordecl-tdz.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for-in/head-const-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for-in/head-const-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for-in/head-const-bound-names-let.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for-in/head-const-fresh-binding-per-iteration.js
@@ -108190,9 +108190,9 @@
 - path: test262/test/language/statements/for-in/head-let-bound-names-fordecl-tdz.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for-in/head-let-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for-in/head-let-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for-in/head-let-bound-names-let.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for-in/head-let-destructuring.js
@@ -110588,9 +110588,9 @@
 - path: test262/test/language/statements/for-of/head-const-bound-names-fordecl-tdz.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for-of/head-const-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for-of/head-const-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for-of/head-const-bound-names-let.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for-of/head-const-fresh-binding-per-iteration.js
@@ -110626,9 +110626,9 @@
 - path: test262/test/language/statements/for-of/head-let-bound-names-fordecl-tdz.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for-of/head-let-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for-of/head-let-bound-names-in-stmt.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/for-of/head-let-bound-names-let.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/for-of/head-let-destructuring.js
@@ -114156,15 +114156,15 @@
 - path: test262/test/language/statements/let/global-use-before-initialization-in-prior-statement.js
   cmd: runTest262 :normal, "ReferenceError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/let/redeclaration-error-from-within-strict-mode-function.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-function-declaration.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-var.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-var.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/let/syntax/escaped-let.js
   cmd: runTest262 :fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-_expression_-strict.js
@@ -114526,7 +114526,7 @@
 - path: test262/test/language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -114588,9 +114588,9 @@
 - path: test262/test/language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -114620,9 +114620,9 @@
 - path: test262/test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-let-declaration.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -114649,10 +114649,14 @@
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-let-declaration.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+- path: test262/test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
+- path: test262/test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -114684,7 +114688,7 @@
 - path: test262/test/language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -114714,9 +114718,9 @@
 - path: test262/test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-let-declaration.js
   cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-var-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js
@@ -114726,13 +114730,13 @@
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-const-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-const-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js
@@ -114742,9 +114746,9 @@
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js
   cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-let-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-let-declaration.js
-  cmd: runTest262 :fail, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "SyntaxError", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-var-declaration.js
   cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-var-declaration.js

Modified: trunk/Source/_javascript_Core/ChangeLog (239353 => 239354)


--- trunk/Source/_javascript_Core/ChangeLog	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-12-18 22:14:20 UTC (rev 239354)
@@ -1,3 +1,39 @@
+2018-12-18  Ross Kirsling  <[email protected]>
+
+        Redeclaration of var over let/const/class should be a syntax error.
+        https://bugs.webkit.org/show_bug.cgi?id=192298
+
+        Reviewed by Keith Miller.
+
+        From https://tc39.github.io/ecma262/#sec-block-static-semantics-early-errors:
+        It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList also occurs in the
+        VarDeclaredNames of StatementList.
+
+        Accordingly, this patch ensures that { let x; { var x; } } and { { var x; } let x; } are syntax errors.
+
+        For the "var after" scenario:
+        When checking for existing lexically-declared names, we can't simply check the current var scope;
+        we need to check *all* enclosing scopes up to (and including) the current var scope. In so doing,
+        we must also avoid violating the Annex B.3.5 condition that allows `try {} catch (e) { var e; }`.
+
+        For the "var before" scenario:
+        We ensure that lexical scopes always keep track of the vars being hoisted over them; this gives us
+        a simple way to check the current block's var-declared names prior to making a lexical declaration.
+
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseTryStatement):
+        * parser/Parser.h:
+        (JSC::Scope::Scope):
+        (JSC::Scope::setIsSimpleCatchParameterScope): Added.
+        (JSC::Scope::isSimpleCatchParameterScope): Added.
+        (JSC::Scope::declareVariable):
+        (JSC::Scope::addVariableBeingHoisted): Added.
+        (JSC::Scope::declareLexicalVariable):
+        (JSC::Scope::hasDeclaredVariable):
+        (JSC::Scope::hasLexicallyDeclaredVariable): Added.
+        (JSC::Parser::declareHoistedVariable): Added.
+        (JSC::Parser::declareVariable):
+
 2018-12-18  David Kilzer  <[email protected]>
 
         clang-tidy: Use const reference for MediaTime parameter to prevent object copy

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (239353 => 239354)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2018-12-18 22:14:20 UTC (rev 239354)
@@ -1759,6 +1759,7 @@
             catchScope->preventVarDeclarations();
             const Identifier* ident = nullptr;
             if (matchSpecIdentifier()) {
+                catchScope->setIsSimpleCatchParameterScope();
                 ident = m_token.m_data.ident;
                 catchPattern = context.createBindingLocation(m_token.m_location, *ident, m_token.m_startPosition, m_token.m_endPosition, AssignmentContext::DeclarationStatement);
                 next();

Modified: trunk/Source/_javascript_Core/parser/Parser.h (239353 => 239354)


--- trunk/Source/_javascript_Core/parser/Parser.h	2018-12-18 22:03:07 UTC (rev 239353)
+++ trunk/Source/_javascript_Core/parser/Parser.h	2018-12-18 22:14:20 UTC (rev 239354)
@@ -173,6 +173,7 @@
         , m_isAsyncFunctionBoundary(false)
         , m_isLexicalScope(false)
         , m_isGlobalCodeScope(false)
+        , m_isSimpleCatchParameterScope(false)
         , m_isFunctionBoundary(false)
         , m_isValidStrictMode(true)
         , m_hasArguments(false)
@@ -290,6 +291,9 @@
     void setIsGlobalCodeScope() { m_isGlobalCodeScope = true; }
     bool isGlobalCodeScope() const { return m_isGlobalCodeScope; }
 
+    void setIsSimpleCatchParameterScope() { m_isSimpleCatchParameterScope = true; }
+    bool isSimpleCatchParameterScope() { return m_isSimpleCatchParameterScope; }
+
     void setIsLexicalScope() 
     { 
         m_isLexicalScope = true;
@@ -354,8 +358,6 @@
         addResult.iterator->value.setIsVar();
         if (!isValidStrictMode)
             result |= DeclarationResult::InvalidStrictMode;
-        if (m_lexicalVariables.contains(ident->impl()))
-            result |= DeclarationResult::InvalidDuplicateDeclaration;
         return result;
     }
 
@@ -388,6 +390,12 @@
         return result;
     }
 
+    void addVariableBeingHoisted(const Identifier* ident)
+    {
+        ASSERT(!m_allowsVarDeclarations);
+        m_variablesBeingHoisted.add(ident->impl());
+    }
+
     void addSloppyModeHoistableFunctionCandidate(const Identifier* ident)
     {
         ASSERT(m_allowsVarDeclarations);
@@ -421,7 +429,7 @@
             addResult.iterator->value.setIsImportedNamespace();
         }
 
-        if (!addResult.isNewEntry)
+        if (!addResult.isNewEntry || m_variablesBeingHoisted.contains(ident->impl()))
             result |= DeclarationResult::InvalidDuplicateDeclaration;
         if (!isValidStrictMode)
             result |= DeclarationResult::InvalidStrictMode;
@@ -429,7 +437,7 @@
         return result;
     }
 
-    bool hasDeclaredVariable(const Identifier& ident)
+    ALWAYS_INLINE bool hasDeclaredVariable(const Identifier& ident)
     {
         return hasDeclaredVariable(ident.impl());
     }
@@ -443,6 +451,11 @@
         return entry.isVar(); // The callee isn't a "var".
     }
 
+    ALWAYS_INLINE bool hasLexicallyDeclaredVariable(const Identifier& ident)
+    {
+        return hasLexicallyDeclaredVariable(ident.impl());
+    }
+
     bool hasLexicallyDeclaredVariable(const RefPtr<UniquedStringImpl>& ident) const
     {
         return m_lexicalVariables.contains(ident.get());
@@ -798,6 +811,7 @@
     bool m_isAsyncFunctionBoundary;
     bool m_isLexicalScope;
     bool m_isGlobalCodeScope;
+    bool m_isSimpleCatchParameterScope;
     bool m_isFunctionBoundary;
     bool m_isValidStrictMode;
     bool m_hasArguments;
@@ -816,6 +830,7 @@
     VariableEnvironment m_declaredVariables;
     VariableEnvironment m_lexicalVariables;
     Vector<UniquedStringImplPtrSet, 6> m_usedVariables;
+    UniquedStringImplPtrSet m_variablesBeingHoisted;
     UniquedStringImplPtrSet m_sloppyModeHoistableFunctionCandidates;
     HashSet<UniquedStringImpl*> m_closedVariableCandidates;
     DeclarationStacks::FunctionStack m_functionDeclarations;
@@ -1208,11 +1223,31 @@
         cleanupScope.setPopped();
         popScopeInternal(scope, shouldTrackClosedVariables);
     }
+
+    NEVER_INLINE DeclarationResultMask declareHoistedVariable(const Identifier* ident)
+    {
+        unsigned i = m_scopeStack.size() - 1;
+        ASSERT(i < m_scopeStack.size());
+        while (true) {
+            // Annex B.3.5 exempts `try {} catch (e) { var e; }` from being a syntax error.
+            // FIXME: This exemption should not apply if the var declaration is a for-of initializer.
+            if (m_scopeStack[i].hasLexicallyDeclaredVariable(*ident) && !m_scopeStack[i].isSimpleCatchParameterScope())
+                return DeclarationResult::InvalidDuplicateDeclaration;
+
+            if (m_scopeStack[i].allowsVarDeclarations())
+                return m_scopeStack[i].declareVariable(ident);
+
+            m_scopeStack[i].addVariableBeingHoisted(ident);
+
+            i--;
+            ASSERT(i < m_scopeStack.size());
+        }
+    }
     
     DeclarationResultMask declareVariable(const Identifier* ident, DeclarationType type = DeclarationType::VarDeclaration, DeclarationImportType importType = DeclarationImportType::NotImported)
     {
         if (type == DeclarationType::VarDeclaration)
-            return currentVariableScope()->declareVariable(ident);
+            return declareHoistedVariable(ident);
 
         ASSERT(type == DeclarationType::LetDeclaration || type == DeclarationType::ConstDeclaration);
         // Lexical variables declared at a top level scope that shadow arguments or vars are not allowed.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to