Skip to content

Commit

Permalink
Update tests for removal of per-parameter position var scope
Browse files Browse the repository at this point in the history
  • Loading branch information
syg committed Dec 17, 2019
1 parent 09380a4 commit 7e82a97
Show file tree
Hide file tree
Showing 33 changed files with 256 additions and 463 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Removal of variable environment for each BindingElement formal parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
---*/
Expand All @@ -28,5 +26,5 @@ var probe1, probe2, probeBody;
})();

assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');
assert.sameValue(probe2(), 'inside');
assert.sameValue(probeBody(), 'inside');
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Creation of new variable environment for each BindingElement formal
parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
---*/
Expand All @@ -27,5 +24,5 @@ var probe1, probe2;
) => {
})();

assert.sameValue(probe1(), 'outside');
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'inside');
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Removal of variable environment for the BindingRestElement formal parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
---*/
Expand All @@ -33,4 +25,4 @@ var probeParam, probeBody;
})();

assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');
assert.sameValue(probeBody(), 'inside');
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Creation of new variable environment for the BindingRestElement formal
parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
---*/
Expand All @@ -32,5 +24,5 @@ var probe1, probe2;
) => {
})();

assert.sameValue(probe1(), 'outside');
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'inside');
20 changes: 9 additions & 11 deletions test/language/expressions/function/scope-param-elem-var-close.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Removal of variable environment for each BindingElement formal parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
---*/
Expand All @@ -28,5 +26,5 @@ var probe1, probe2, probeBody;
}());

assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');
assert.sameValue(probe2(), 'inside');
assert.sameValue(probeBody(), 'inside');
19 changes: 8 additions & 11 deletions test/language/expressions/function/scope-param-elem-var-open.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Creation of new variable environment for each BindingElement formal
parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
---*/
Expand All @@ -27,5 +24,5 @@ var probe1, probe2;
) {
}());

assert.sameValue(probe1(), 'outside');
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'inside');
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Removal of variable environment for the BindingRestElement formal parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
---*/
Expand All @@ -33,4 +25,4 @@ var probeParam, probeBody;
}());

assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');
assert.sameValue(probeBody(), 'inside');
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Creation of new variable environment for the BindingRestElement formal
parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
---*/
Expand All @@ -32,5 +24,5 @@ var probe1, probe2;
) {
}());

assert.sameValue(probe1(), 'outside');
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'inside');
20 changes: 9 additions & 11 deletions test/language/expressions/generators/scope-param-elem-var-close.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Removal of variable environment for each BindingElement formal parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
features: [generators]
Expand All @@ -29,5 +27,5 @@ var probe1, probe2, probeBody;
}()).next();

assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'outside');
assert.sameValue(probeBody(), 'outside');
assert.sameValue(probe2(), 'inside');
assert.sameValue(probeBody(), 'inside');
19 changes: 8 additions & 11 deletions test/language/expressions/generators/scope-param-elem-var-open.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Creation of new variable environment for each BindingElement formal
parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
features: [generators]
Expand All @@ -28,5 +25,5 @@ var probe1, probe2;
) {
}().next());

assert.sameValue(probe1(), 'outside');
assert.sameValue(probe1(), 'inside');
assert.sameValue(probe2(), 'inside');
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
// 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
esid: sec-functiondeclarationinstantiation
description: >
Removal of variable environment for the BindingRestElement formal parameter
sloppy direct evals in params introduce vars
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.
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
b. Let calleeEnv be the LexicalEnvironment of calleeContext.
c. Let env be NewDeclarativeEnvironment(calleeEnv).
d. Let envRec be env's EnvironmentRecord.
[...]
flags: [noStrict]
features: [generators]
Expand All @@ -34,4 +26,4 @@ var probeParam, probeBody;
}().next());

assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');
assert.sameValue(probeBody(), 'inside');
Loading

0 comments on commit 7e82a97

Please sign in to comment.