From 4f4039f716e9b6c1987d890999b282c0d97a2e03 Mon Sep 17 00:00:00 2001
From: Rick Waldron <waldron.rick@gmail.com>
Date: Mon, 21 Aug 2017 11:30:09 -0400
Subject: [PATCH] try/catch: catch parameter bound names clean up (#1172)

---
 test/language/statements/try/12.14.1-1-s.js   | 17 ------------
 test/language/statements/try/12.14.1-1gs.js   | 18 -------------
 test/language/statements/try/12.14.1-2-s.js   | 17 ------------
 test/language/statements/try/12.14.1-3-s.js   | 26 -------------------
 ...names-restriction-arguments-eval-throws.js | 13 ++++++++++
 ...es-restriction-arguments-negative-early.js | 16 ++++++++++++
 ...boundnames-restriction-eval-eval-throws.js | 13 ++++++++++
 ...ndnames-restriction-eval-negative-early.js | 16 ++++++++++++
 8 files changed, 58 insertions(+), 78 deletions(-)
 delete mode 100644 test/language/statements/try/12.14.1-1-s.js
 delete mode 100644 test/language/statements/try/12.14.1-1gs.js
 delete mode 100644 test/language/statements/try/12.14.1-2-s.js
 delete mode 100644 test/language/statements/try/12.14.1-3-s.js
 create mode 100644 test/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws.js
 create mode 100644 test/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early.js
 create mode 100644 test/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws.js
 create mode 100644 test/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early.js

diff --git a/test/language/statements/try/12.14.1-1-s.js b/test/language/statements/try/12.14.1-1-s.js
deleted file mode 100644
index 688e10439d..0000000000
--- a/test/language/statements/try/12.14.1-1-s.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2012 Ecma International.  All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-es5id: 12.14.1-1-s
-description: >
-    Strict Mode - SyntaxError is thrown if a TryStatement with a Catch
-    occurs within strict code and the Identifier of the Catch
-    production is eval
-flags: [onlyStrict]
----*/
-
-assert.throws(SyntaxError, function() {
-            eval("\
-                   try {} catch (eval) { }\
-            ");
-});
diff --git a/test/language/statements/try/12.14.1-1gs.js b/test/language/statements/try/12.14.1-1gs.js
deleted file mode 100644
index 036765dd9c..0000000000
--- a/test/language/statements/try/12.14.1-1gs.js
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) 2012 Ecma International.  All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-es5id: 12.14.1-1gs
-description: >
-    Strict Mode - SyntaxError is thrown if a TryStatement with a Catch
-    occurs within strict code and the Identifier of the Catch
-    production is eval
-negative:
-  phase: early
-  type: SyntaxError
-flags: [onlyStrict]
----*/
-
-throw "Test262: This statement should not be evaluated.";
-
-try { } catch (eval) { }
diff --git a/test/language/statements/try/12.14.1-2-s.js b/test/language/statements/try/12.14.1-2-s.js
deleted file mode 100644
index 7977218340..0000000000
--- a/test/language/statements/try/12.14.1-2-s.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2012 Ecma International.  All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-es5id: 12.14.1-2-s
-description: >
-    Strict Mode - SyntaxError is thrown if a TryStatement with a Catch
-    occurs within strict code and the Identifier of the Catch
-    production is arguments
-flags: [onlyStrict]
----*/
-
-assert.throws(SyntaxError, function() {
-            eval("\
-                   try {} catch (arguments) { }\
-            ");
-});
diff --git a/test/language/statements/try/12.14.1-3-s.js b/test/language/statements/try/12.14.1-3-s.js
deleted file mode 100644
index 7223984812..0000000000
--- a/test/language/statements/try/12.14.1-3-s.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2012 Ecma International.  All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-es5id: 12.14.1-3-s
-description: >
-    Strict Mode - SyntaxError isn't thrown if a TryStatement with a
-    Catch occurs within strict code and the Identifier of the Catch
-    production is EVAL but throws SyntaxError if it is eval
-flags: [onlyStrict]
----*/
-
-assert.throws(SyntaxError, function() {
- eval(" try { \
-             throw new Error(\"...\");\
-             return false;\
-         } catch (EVAL) {\
-             try\
-             {\
-               throw new Error(\"...\");\
-             }catch(eval)\
-             {\
-                 return EVAL instanceof Error;\
-              }\
-         }");
-});
diff --git a/test/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws.js b/test/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws.js
new file mode 100644
index 0000000000..80a49a5b29
--- /dev/null
+++ b/test/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+    It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+flags: [onlyStrict]
+---*/
+
+assert.throws(SyntaxError, function() {
+  eval("try {} catch (arguments) { }");
+});
diff --git a/test/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early.js b/test/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early.js
new file mode 100644
index 0000000000..72dd87f728
--- /dev/null
+++ b/test/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+    It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+negative:
+  phase: early
+  type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+try { } catch (arguments) { }
diff --git a/test/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws.js b/test/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws.js
new file mode 100644
index 0000000000..086ea255ba
--- /dev/null
+++ b/test/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+    It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+flags: [onlyStrict]
+---*/
+
+assert.throws(SyntaxError, function() {
+  eval("try {} catch (eval) { }");
+});
diff --git a/test/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early.js b/test/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early.js
new file mode 100644
index 0000000000..277fc16809
--- /dev/null
+++ b/test/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+    It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+negative:
+  phase: early
+  type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+try { } catch (eval) { }
-- 
GitLab