From 74d0c1d124fd9a877c0134240f34398e8be216b0 Mon Sep 17 00:00:00 2001
From: Mike Pennisi <mike@mikepennisi.com>
Date: Wed, 27 Apr 2016 13:54:19 -0400
Subject: [PATCH] Add equivalent tests for fn param-body boundary

These tests are based on the files introduced in the commit titled, "Add
tests for Lexical Environment management."
---
 .../scope-paramsbody-var-close.js             | 34 +++++++++++++++++
 .../scope-paramsbody-var-open.js              | 32 ++++++++++++++++
 .../scope-gen-meth-paramsbody-var-close.js    | 37 +++++++++++++++++++
 .../scope-gen-meth-paramsbody-var-open.js     | 35 ++++++++++++++++++
 .../class/scope-meth-paramsbody-var-close.js  | 37 +++++++++++++++++++
 .../class/scope-meth-paramsbody-var-open.js   | 35 ++++++++++++++++++
 .../scope-setter-paramsbody-var-close.js      | 37 +++++++++++++++++++
 .../class/scope-setter-paramsbody-var-open.js | 35 ++++++++++++++++++
 ...pe-static-gen-meth-paramsbody-var-close.js | 37 +++++++++++++++++++
 ...ope-static-gen-meth-paramsbody-var-open.js | 35 ++++++++++++++++++
 .../scope-static-meth-paramsbody-var-close.js | 37 +++++++++++++++++++
 .../scope-static-meth-paramsbody-var-open.js  | 35 ++++++++++++++++++
 ...cope-static-setter-paramsbody-var-close.js | 37 +++++++++++++++++++
 ...scope-static-setter-paramsbody-var-open.js | 35 ++++++++++++++++++
 .../generators/scope-paramsbody-var-close.js  | 34 +++++++++++++++++
 .../generators/scope-paramsbody-var-open.js   | 32 ++++++++++++++++
 .../scope-gen-meth-paramsbody-var-close.js    | 36 ++++++++++++++++++
 .../scope-gen-meth-paramsbody-var-open.js     | 34 +++++++++++++++++
 .../object/scope-meth-paramsbody-var-close.js | 36 ++++++++++++++++++
 .../object/scope-meth-paramsbody-var-open.js  | 34 +++++++++++++++++
 .../scope-setter-paramsbody-var-close.js      | 36 ++++++++++++++++++
 .../scope-setter-paramsbody-var-open.js       | 34 +++++++++++++++++
 .../scope-gen-meth-paramsbody-var-close.js    | 37 +++++++++++++++++++
 .../scope-gen-meth-paramsbody-var-open.js     | 35 ++++++++++++++++++
 .../class/scope-meth-paramsbody-var-close.js  | 37 +++++++++++++++++++
 .../class/scope-meth-paramsbody-var-open.js   | 35 ++++++++++++++++++
 .../scope-setter-paramsbody-var-close.js      | 37 +++++++++++++++++++
 .../class/scope-setter-paramsbody-var-open.js | 35 ++++++++++++++++++
 ...pe-static-gen-meth-paramsbody-var-close.js | 37 +++++++++++++++++++
 ...ope-static-gen-meth-paramsbody-var-open.js | 35 ++++++++++++++++++
 .../scope-static-meth-paramsbody-var-close.js | 37 +++++++++++++++++++
 .../scope-static-meth-paramsbody-var-open.js  | 35 ++++++++++++++++++
 ...cope-static-setter-paramsbody-var-close.js | 37 +++++++++++++++++++
 ...scope-static-setter-paramsbody-var-open.js | 35 ++++++++++++++++++
 .../function/scope-paramsbody-var-close.js    | 35 ++++++++++++++++++
 .../function/scope-paramsbody-var-open.js     | 33 +++++++++++++++++
 .../generators/scope-paramsbody-var-close.js  | 35 ++++++++++++++++++
 .../generators/scope-paramsbody-var-open.js   | 33 +++++++++++++++++
 38 files changed, 1342 insertions(+)
 create mode 100644 test/language/expressions/arrow-function/scope-paramsbody-var-close.js
 create mode 100644 test/language/expressions/arrow-function/scope-paramsbody-var-open.js
 create mode 100644 test/language/expressions/class/scope-gen-meth-paramsbody-var-close.js
 create mode 100644 test/language/expressions/class/scope-gen-meth-paramsbody-var-open.js
 create mode 100644 test/language/expressions/class/scope-meth-paramsbody-var-close.js
 create mode 100644 test/language/expressions/class/scope-meth-paramsbody-var-open.js
 create mode 100644 test/language/expressions/class/scope-setter-paramsbody-var-close.js
 create mode 100644 test/language/expressions/class/scope-setter-paramsbody-var-open.js
 create mode 100644 test/language/expressions/class/scope-static-gen-meth-paramsbody-var-close.js
 create mode 100644 test/language/expressions/class/scope-static-gen-meth-paramsbody-var-open.js
 create mode 100644 test/language/expressions/class/scope-static-meth-paramsbody-var-close.js
 create mode 100644 test/language/expressions/class/scope-static-meth-paramsbody-var-open.js
 create mode 100644 test/language/expressions/class/scope-static-setter-paramsbody-var-close.js
 create mode 100644 test/language/expressions/class/scope-static-setter-paramsbody-var-open.js
 create mode 100644 test/language/expressions/generators/scope-paramsbody-var-close.js
 create mode 100644 test/language/expressions/generators/scope-paramsbody-var-open.js
 create mode 100644 test/language/expressions/object/scope-gen-meth-paramsbody-var-close.js
 create mode 100644 test/language/expressions/object/scope-gen-meth-paramsbody-var-open.js
 create mode 100644 test/language/expressions/object/scope-meth-paramsbody-var-close.js
 create mode 100644 test/language/expressions/object/scope-meth-paramsbody-var-open.js
 create mode 100644 test/language/expressions/object/scope-setter-paramsbody-var-close.js
 create mode 100644 test/language/expressions/object/scope-setter-paramsbody-var-open.js
 create mode 100644 test/language/statements/class/scope-gen-meth-paramsbody-var-close.js
 create mode 100644 test/language/statements/class/scope-gen-meth-paramsbody-var-open.js
 create mode 100644 test/language/statements/class/scope-meth-paramsbody-var-close.js
 create mode 100644 test/language/statements/class/scope-meth-paramsbody-var-open.js
 create mode 100644 test/language/statements/class/scope-setter-paramsbody-var-close.js
 create mode 100644 test/language/statements/class/scope-setter-paramsbody-var-open.js
 create mode 100644 test/language/statements/class/scope-static-gen-meth-paramsbody-var-close.js
 create mode 100644 test/language/statements/class/scope-static-gen-meth-paramsbody-var-open.js
 create mode 100644 test/language/statements/class/scope-static-meth-paramsbody-var-close.js
 create mode 100644 test/language/statements/class/scope-static-meth-paramsbody-var-open.js
 create mode 100644 test/language/statements/class/scope-static-setter-paramsbody-var-close.js
 create mode 100644 test/language/statements/class/scope-static-setter-paramsbody-var-open.js
 create mode 100644 test/language/statements/function/scope-paramsbody-var-close.js
 create mode 100644 test/language/statements/function/scope-paramsbody-var-open.js
 create mode 100644 test/language/statements/generators/scope-paramsbody-var-close.js
 create mode 100644 test/language/statements/generators/scope-paramsbody-var-open.js

diff --git a/test/language/expressions/arrow-function/scope-paramsbody-var-close.js b/test/language/expressions/arrow-function/scope-paramsbody-var-close.js
new file mode 100644
index 0000000000..a0472fc272
--- /dev/null
+++ b/test/language/expressions/arrow-function/scope-paramsbody-var-close.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+// A parameter expression is necessary to trigger the creation of the scope
+// under test.
+((_ = null) => {
+  var x = 'inside';
+  probe = function() { return x; };
+})();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/arrow-function/scope-paramsbody-var-open.js b/test/language/expressions/arrow-function/scope-paramsbody-var-open.js
new file mode 100644
index 0000000000..c0bc7669fa
--- /dev/null
+++ b/test/language/expressions/arrow-function/scope-paramsbody-var-open.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+((_ = probeParams = function() { return x; }) => {
+  var x = 'inside';
+  probeBody = function() { return x; };
+})();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/class/scope-gen-meth-paramsbody-var-close.js b/test/language/expressions/class/scope-gen-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..d0f4280f8f
--- /dev/null
+++ b/test/language/expressions/class/scope-gen-meth-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+var C = class {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  *m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+};
+C.prototype.m().next();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/class/scope-gen-meth-paramsbody-var-open.js b/test/language/expressions/class/scope-gen-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..1b09a356e9
--- /dev/null
+++ b/test/language/expressions/class/scope-gen-meth-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+var C = class{
+  *m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+};
+C.prototype.m().next();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/class/scope-meth-paramsbody-var-close.js b/test/language/expressions/class/scope-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..b3b9a67fa7
--- /dev/null
+++ b/test/language/expressions/class/scope-meth-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+var C = class {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+};
+C.prototype.m();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/class/scope-meth-paramsbody-var-open.js b/test/language/expressions/class/scope-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..843a8b6d3e
--- /dev/null
+++ b/test/language/expressions/class/scope-meth-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+var C = class {
+  m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+};
+C.prototype.m();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/class/scope-setter-paramsbody-var-close.js b/test/language/expressions/class/scope-setter-paramsbody-var-close.js
new file mode 100644
index 0000000000..9d025c2230
--- /dev/null
+++ b/test/language/expressions/class/scope-setter-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+var C = class {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  set a(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+};
+C.prototype.a = null;
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/class/scope-setter-paramsbody-var-open.js b/test/language/expressions/class/scope-setter-paramsbody-var-open.js
new file mode 100644
index 0000000000..46db7ba16b
--- /dev/null
+++ b/test/language/expressions/class/scope-setter-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+var C = class {
+  set a(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+};
+C.prototype.a = undefined;
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/class/scope-static-gen-meth-paramsbody-var-close.js b/test/language/expressions/class/scope-static-gen-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..26ef25edc8
--- /dev/null
+++ b/test/language/expressions/class/scope-static-gen-meth-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+var C = class {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  static *m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+};
+C.m().next();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/class/scope-static-gen-meth-paramsbody-var-open.js b/test/language/expressions/class/scope-static-gen-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..17167c3ce4
--- /dev/null
+++ b/test/language/expressions/class/scope-static-gen-meth-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+var C = class {
+  static *m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+};
+C.m().next();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/class/scope-static-meth-paramsbody-var-close.js b/test/language/expressions/class/scope-static-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..6b55004eac
--- /dev/null
+++ b/test/language/expressions/class/scope-static-meth-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+var C = class {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  static m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+};
+C.m();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/class/scope-static-meth-paramsbody-var-open.js b/test/language/expressions/class/scope-static-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..44dfe39d76
--- /dev/null
+++ b/test/language/expressions/class/scope-static-meth-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+var C = class {
+  static m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+};
+C.m();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/class/scope-static-setter-paramsbody-var-close.js b/test/language/expressions/class/scope-static-setter-paramsbody-var-close.js
new file mode 100644
index 0000000000..1ded6d1b4e
--- /dev/null
+++ b/test/language/expressions/class/scope-static-setter-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+var C = class {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  static set a(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+};
+C.a = null;
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/class/scope-static-setter-paramsbody-var-open.js b/test/language/expressions/class/scope-static-setter-paramsbody-var-open.js
new file mode 100644
index 0000000000..5f01fdbe5d
--- /dev/null
+++ b/test/language/expressions/class/scope-static-setter-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+var C = class {
+  static set a(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+};
+C.a = undefined;
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/generators/scope-paramsbody-var-close.js b/test/language/expressions/generators/scope-paramsbody-var-close.js
new file mode 100644
index 0000000000..520b549c9a
--- /dev/null
+++ b/test/language/expressions/generators/scope-paramsbody-var-close.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+// A parameter expression is necessary to trigger the creation of the scope
+// under test.
+(function*(_ = null) {
+  var x = 'inside';
+  probe = function() { return x; };
+}().next());
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/generators/scope-paramsbody-var-open.js b/test/language/expressions/generators/scope-paramsbody-var-open.js
new file mode 100644
index 0000000000..d36a986079
--- /dev/null
+++ b/test/language/expressions/generators/scope-paramsbody-var-open.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+(function*(_ = probeParams = function() { return x; }) {
+  var x = 'inside';
+  probeBody = function() { return x; };
+}().next());
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/object/scope-gen-meth-paramsbody-var-close.js b/test/language/expressions/object/scope-gen-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..612ef84fdf
--- /dev/null
+++ b/test/language/expressions/object/scope-gen-meth-paramsbody-var-close.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+({
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  *m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}.m().next());
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/object/scope-gen-meth-paramsbody-var-open.js b/test/language/expressions/object/scope-gen-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..f3a1e4f9b0
--- /dev/null
+++ b/test/language/expressions/object/scope-gen-meth-paramsbody-var-open.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+({
+  *m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}.m().next());
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/object/scope-meth-paramsbody-var-close.js b/test/language/expressions/object/scope-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..f6958d0bed
--- /dev/null
+++ b/test/language/expressions/object/scope-meth-paramsbody-var-close.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+({
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}.m());
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/object/scope-meth-paramsbody-var-open.js b/test/language/expressions/object/scope-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..b8b2716e40
--- /dev/null
+++ b/test/language/expressions/object/scope-meth-paramsbody-var-open.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+({
+  m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}.m());
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/expressions/object/scope-setter-paramsbody-var-close.js b/test/language/expressions/object/scope-setter-paramsbody-var-close.js
new file mode 100644
index 0000000000..b9458d7142
--- /dev/null
+++ b/test/language/expressions/object/scope-setter-paramsbody-var-close.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+({
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  set a(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}.a = null);
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/expressions/object/scope-setter-paramsbody-var-open.js b/test/language/expressions/object/scope-setter-paramsbody-var-open.js
new file mode 100644
index 0000000000..ce04f2ac35
--- /dev/null
+++ b/test/language/expressions/object/scope-setter-paramsbody-var-open.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+({
+  set a(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}.a = undefined);
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/statements/class/scope-gen-meth-paramsbody-var-close.js b/test/language/statements/class/scope-gen-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..e05a47fcd2
--- /dev/null
+++ b/test/language/statements/class/scope-gen-meth-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+class C {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  *m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}
+C.prototype.m().next();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/statements/class/scope-gen-meth-paramsbody-var-open.js b/test/language/statements/class/scope-gen-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..ae60bf59ba
--- /dev/null
+++ b/test/language/statements/class/scope-gen-meth-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+  *m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}
+C.prototype.m().next();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/statements/class/scope-meth-paramsbody-var-close.js b/test/language/statements/class/scope-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..ad48007664
--- /dev/null
+++ b/test/language/statements/class/scope-meth-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+class C {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}
+C.prototype.m();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/statements/class/scope-meth-paramsbody-var-open.js b/test/language/statements/class/scope-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..827e3c6eb1
--- /dev/null
+++ b/test/language/statements/class/scope-meth-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+  m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}
+C.prototype.m();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/statements/class/scope-setter-paramsbody-var-close.js b/test/language/statements/class/scope-setter-paramsbody-var-close.js
new file mode 100644
index 0000000000..b379cad2a0
--- /dev/null
+++ b/test/language/statements/class/scope-setter-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+class C {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  set a(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}
+C.prototype.a = null;
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/statements/class/scope-setter-paramsbody-var-open.js b/test/language/statements/class/scope-setter-paramsbody-var-open.js
new file mode 100644
index 0000000000..1fca0b2b36
--- /dev/null
+++ b/test/language/statements/class/scope-setter-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+  set a(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}
+C.prototype.a = undefined;
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/statements/class/scope-static-gen-meth-paramsbody-var-close.js b/test/language/statements/class/scope-static-gen-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..e830855773
--- /dev/null
+++ b/test/language/statements/class/scope-static-gen-meth-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+class C {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  static *m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}
+C.m().next();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/statements/class/scope-static-gen-meth-paramsbody-var-open.js b/test/language/statements/class/scope-static-gen-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..8ffba8b382
--- /dev/null
+++ b/test/language/statements/class/scope-static-gen-meth-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+  static *m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}
+C.m().next();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/statements/class/scope-static-meth-paramsbody-var-close.js b/test/language/statements/class/scope-static-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..b26d03cb96
--- /dev/null
+++ b/test/language/statements/class/scope-static-meth-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+class C {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  static m(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}
+C.m();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/statements/class/scope-static-meth-paramsbody-var-open.js b/test/language/statements/class/scope-static-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..2d166ccba8
--- /dev/null
+++ b/test/language/statements/class/scope-static-meth-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+  static m(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}
+C.m();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/statements/class/scope-static-setter-paramsbody-var-close.js b/test/language/statements/class/scope-static-setter-paramsbody-var-close.js
new file mode 100644
index 0000000000..c3dd673911
--- /dev/null
+++ b/test/language/statements/class/scope-static-setter-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+class C {
+  // A parameter expression is necessary to trigger the creation of the scope
+  // under test.
+  static set a(_ = null) {
+    var x = 'inside';
+    probe = function() { return x; };
+  }
+}
+C.a = null;
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/statements/class/scope-static-setter-paramsbody-var-open.js b/test/language/statements/class/scope-static-setter-paramsbody-var-open.js
new file mode 100644
index 0000000000..ead07acabd
--- /dev/null
+++ b/test/language/statements/class/scope-static-setter-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+  static set a(_ = probeParams = function() { return x; }) {
+    var x = 'inside';
+    probeBody = function() { return x; };
+  }
+}
+C.a = undefined;
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/statements/function/scope-paramsbody-var-close.js b/test/language/statements/function/scope-paramsbody-var-close.js
new file mode 100644
index 0000000000..f99b49bf77
--- /dev/null
+++ b/test/language/statements/function/scope-paramsbody-var-close.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+// A parameter expression is necessary to trigger the creation of the scope
+// under test.
+function f(_ = null) {
+  var x = 'inside';
+  probe = function() { return x; };
+}
+f();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/statements/function/scope-paramsbody-var-open.js b/test/language/statements/function/scope-paramsbody-var-open.js
new file mode 100644
index 0000000000..b460625d9b
--- /dev/null
+++ b/test/language/statements/function/scope-paramsbody-var-open.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+function f(_ = probeParams = function() { return x; }) {
+  var x = 'inside';
+  probeBody = function() { return x; };
+}
+f();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
diff --git a/test/language/statements/generators/scope-paramsbody-var-close.js b/test/language/statements/generators/scope-paramsbody-var-close.js
new file mode 100644
index 0000000000..22fd3651e8
--- /dev/null
+++ b/test/language/statements/generators/scope-paramsbody-var-close.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Disposal of variable environment for the function body
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var probe;
+
+// A parameter expression is necessary to trigger the creation of the scope
+// under test.
+function* g(_ = null) {
+  var x = 'inside';
+  probe = function() { return x; };
+}
+g().next();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
diff --git a/test/language/statements/generators/scope-paramsbody-var-open.js b/test/language/statements/generators/scope-paramsbody-var-open.js
new file mode 100644
index 0000000000..e84dcca348
--- /dev/null
+++ b/test/language/statements/generators/scope-paramsbody-var-open.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+    Creation of new variable environment for the function body (as disinct from
+    that for the function's parameters)
+info: |
+    [...]
+    26. If hasParameterExpressions is false, then
+        [...]
+    27. Else,
+        a. NOTE A separate Environment Record is needed to ensure that closures
+           created by expressions in the formal parameter list do not have
+           visibility of declarations in the function body.
+        b. Let varEnv be NewDeclarativeEnvironment(env).
+        c. Let varEnvRec be varEnv's EnvironmentRecord.
+        d. Set the VariableEnvironment of calleeContext to varEnv.
+        e. Let instantiatedVarNames be a new empty List.
+        [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+function* g(_ = probeParams = function() { return x; }) {
+  var x = 'inside';
+  probeBody = function() { return x; };
+}
+g().next();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');