Add equivalent tests for non-strict fn parameters

These tests are based on the files introduced in the commit titled, "Add
tests for Lexical Environment management."
This commit is contained in:
Mike Pennisi 2016-04-27 13:16:49 -04:00
parent 9c3ff83c00
commit c9a93c1d1c
24 changed files with 830 additions and 0 deletions

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for each BindingElement formal parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2, probeBody;
((
_ = (eval('var x = "inside";'), probe1 = function() { return x; }),
__ = probe2 = function() { return x; }
) => {
probeBody = function() { return x; };
})();
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');

View File

@ -0,0 +1,31 @@
// 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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for each BindingElement formal
parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
((
_ = probe1 = function() { return x; },
__ = (eval('var x = "inside";'), probe2 = function() { return x; })
) => {
})();
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for the BindingRestElement formal parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the
arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probeParam, probeBody;
((
...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
) => {
probeBody = function() { return x; }
})();
assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for the BindingRestElement formal
parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
((
_ = probe1 = function() { return x; },
...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })]
) => {
})();
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for each BindingElement formal parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2, probeBody;
(function*(
_ = (eval('var x = "inside";'), probe1 = function() { return x; }),
__ = probe2 = function() { return x; }
) {
probeBody = function() { return x; };
}()).next();
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');

View File

@ -0,0 +1,31 @@
// 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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for each BindingElement formal
parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
(function*(
_ = probe1 = function() { return x; },
__ = (eval('var x = "inside";'), probe2 = function() { return x; })
) {
}().next());
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for the BindingRestElement formal parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the
arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probeParam, probeBody;
(function*(
...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
) {
probeBody = function() { return x; }
}().next());
assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for the BindingRestElement formal
parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
(function*(
_ = probe1 = function() { return x; },
...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })]
) {
}().next());
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for each BindingElement formal parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2, probeBody;
({
*m(
_ = (eval('var x = "inside";'), probe1 = function() { return x; }),
__ = probe2 = function() { return x; }
) {
probeBody = function() { return x; };
}
}.m().next());
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for each BindingElement formal
parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
({
*m(
_ = probe1 = function() { return x; },
__ = (eval('var x = "inside";'), probe2 = function() { return x; })
) {}
}.m().next());
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -0,0 +1,38 @@
// 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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for the BindingRestElement formal parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the
arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probeParam, probeBody;
({
*m(
...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
) {
probeBody = function() { return x; }
}
}.m().next());
assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for the BindingRestElement formal
parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
({
*m(
_ = probe1 = function() { return x; },
...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })]
) {}
}.m().next());
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for each BindingElement formal parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2, probeBody;
({
m(
_ = (eval('var x = "inside";'), probe1 = function() { return x; }),
__ = probe2 = function() { return x; }
) {
probeBody = function() { return x; };
}
}.m());
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for each BindingElement formal
parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
({
m(
_ = probe1 = function() { return x; },
__ = (eval('var x = "inside";'), probe2 = function() { return x; })
) {}
}.m());
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -0,0 +1,38 @@
// 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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for the BindingRestElement formal parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the
arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probeParam, probeBody;
({
m(
...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
) {
probeBody = function() { return x; }
}
}.m());
assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for the BindingRestElement formal
parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
({
m(
_ = probe1 = function() { return x; },
...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })]
) {}
}.m());
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for each BindingElement formal parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2, probeBody;
function f(
_ = (eval('var x = "inside";'), probe1 = function() { return x; }),
__ = probe2 = function() { return x; }
) {
probeBody = function() { return x; };
}
f();
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for each BindingElement formal
parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
function f(
_ = probe1 = function() { return x; },
__ = (eval('var x = "inside";'), probe2 = function() { return x; })
) {
}
f();
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for the BindingRestElement formal parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the
arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probeParam, probeBody;
function f(
...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
) {
probeBody = function() { return x; }
}
f();
assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for the BindingRestElement formal
parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
function f(
_ = probe1 = function() { return x; },
...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })]
) {
}
f();
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for each BindingElement formal parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2, probeBody;
function* g(
_ = (eval('var x = "inside";'), probe1 = function() { return x; }),
__ = probe2 = function() { return x; }
) {
probeBody = function() { return x; };
}
g().next();
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for each BindingElement formal
parameter
info: |
[...]
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
function* g(
_ = probe1 = function() { return x; },
__ = (eval('var x = "inside";'), probe2 = function() { return x; })
) {
}
g().next();
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Removal of variable environment for the BindingRestElement formal parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the
arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probeParam, probeBody;
function* g(
...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
) {
probeBody = function() { return x; }
}
g().next();
assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');

View File

@ -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-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
Creation of new variable environment for the BindingRestElement formal
parameter
info: |
[...]
2. Let currentContext be the running execution context.
3. Let originalEnv be the VariableEnvironment of currentContext.
4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
are the same.
5. Assert: environment and originalEnv are the same.
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
7. Set the VariableEnvironment of currentContext to paramVarEnv.
8. Set the LexicalEnvironment of currentContext to paramVarEnv.
9. Let result be the result of performing IteratorBindingInitialization for
BindingRestElement using iteratorRecord and environment as the arguments.
10. Set the VariableEnvironment of currentContext to originalEnv.
11. Set the LexicalEnvironment of currentContext to originalEnv.
[...]
flags: [noStrict]
---*/
var x = 'outside';
var probe1, probe2;
function* g(
_ = probe1 = function() { return x; },
...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })]
) {
}
g().next();
assert.sameValue(probe1(), 'outside');
assert.sameValue(probe2(), 'inside');