Generate tests

This commit is contained in:
Rick Waldron 2020-09-25 15:47:38 -04:00
parent bba4fbc259
commit 677ae94ae9
24 changed files with 2102 additions and 0 deletions

View File

@ -0,0 +1,100 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/arrow-function.template
/*---
description: Symbol.unscopables behavior across scope boundaries (arrow function expression)
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
features: [globalThis, Symbol.unscopables]
flags: [generated, noStrict]
info: |
ArrowFunction : ArrowParameters => ConciseBody
[...]
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = (x) => {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10);
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,94 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/arrow-function.template
/*---
description: Symbol.unscopables behavior across scope boundaries (arrow function expression)
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
features: [globalThis, Symbol.unscopables]
flags: [generated, noStrict]
info: |
ArrowFunction : ArrowParameters => ConciseBody
[...]
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = (x) => {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10);
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,94 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/async-arrow-function.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async arrow function expression)
esid: sec-async-arrow-function-definitions
features: [globalThis, Symbol.unscopables, async-functions]
flags: [generated, noStrict, async]
info: |
14.7 Async Arrow Function Definitions
AsyncArrowFunction :
...
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
AsyncConciseBody :
{ AsyncFunctionBody }
...
Supplemental Syntax
When processing an instance of the production AsyncArrowFunction :
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
AsyncArrowHead :
async ArrowFormalParameters
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref = async (x) => {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).then(() => {
assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,88 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/async-arrow-function.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async arrow function expression)
esid: sec-async-arrow-function-definitions
features: [globalThis, Symbol.unscopables, async-functions]
flags: [generated, noStrict, async]
info: |
14.7 Async Arrow Function Definitions
AsyncArrowFunction :
...
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
AsyncConciseBody :
{ AsyncFunctionBody }
...
Supplemental Syntax
When processing an instance of the production AsyncArrowFunction :
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
AsyncArrowHead :
async ArrowFormalParameters
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref = async (x) => {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).then(() => {
assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,80 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/async-func-expr-named.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async function named expression)
esid: sec-async-function-definitions
features: [globalThis, Symbol.unscopables, async-functions]
flags: [generated, noStrict, async]
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function ref(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,74 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/async-func-expr-named.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async function named expression)
esid: sec-async-function-definitions
features: [globalThis, Symbol.unscopables, async-functions]
flags: [generated, noStrict, async]
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function ref(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,80 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/async-func-expr-nameless.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async function nameless expression)
esid: sec-async-function-definitions
features: [globalThis, Symbol.unscopables, async-functions]
flags: [generated, noStrict, async]
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody }
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,74 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/async-func-expr-nameless.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async function nameless expression)
esid: sec-async-function-definitions
features: [globalThis, Symbol.unscopables, async-functions]
flags: [generated, noStrict, async]
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody }
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,82 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/async-gen-named-func-expr.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async generator named function expression)
esid: sec-asyncgenerator-definitions-evaluation
features: [globalThis, Symbol.unscopables, async-iteration]
flags: [generated, noStrict, async]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, funcEnv, strict).
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function* g(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).next().then(() => {
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,76 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/async-gen-named-func-expr.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async generator named function expression)
esid: sec-asyncgenerator-definitions-evaluation
features: [globalThis, Symbol.unscopables, async-iteration]
flags: [generated, noStrict, async]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, funcEnv, strict).
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function* g(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).next().then(() => {
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,82 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/async-gen-func-expr.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async generator function expression)
esid: sec-asyncgenerator-definitions-evaluation
features: [globalThis, Symbol.unscopables, async-iteration]
flags: [generated, noStrict, async]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
[...]
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function*(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).next().then(() => {
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,76 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/async-gen-func-expr.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async generator function expression)
esid: sec-asyncgenerator-definitions-evaluation
features: [globalThis, Symbol.unscopables, async-iteration]
flags: [generated, noStrict, async]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
[...]
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function*(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).next().then(() => {
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,102 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/func-expr.template
/*---
description: Symbol.unscopables behavior across scope boundaries (function expression)
esid: sec-function-definitions-runtime-semantics-evaluation
features: [globalThis, Symbol.unscopables]
flags: [generated, noStrict]
info: |
FunctionExpression : function ( FormalParameters ) { FunctionBody }
[...]
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = function(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10);
assert.sameValue(callCount, 1, 'function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,96 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/func-expr.template
/*---
description: Symbol.unscopables behavior across scope boundaries (function expression)
esid: sec-function-definitions-runtime-semantics-evaluation
features: [globalThis, Symbol.unscopables]
flags: [generated, noStrict]
info: |
FunctionExpression : function ( FormalParameters ) { FunctionBody }
[...]
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = function(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10);
assert.sameValue(callCount, 1, 'function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,103 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/gen-func-expr.template
/*---
description: Symbol.unscopables behavior across scope boundaries (generator function expression)
esid: sec-generator-function-definitions-runtime-semantics-evaluation
features: [globalThis, Symbol.unscopables, generators]
flags: [generated, noStrict]
info: |
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
[...]
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
GeneratorBody, scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = function*(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).next();
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,97 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/gen-func-expr.template
/*---
description: Symbol.unscopables behavior across scope boundaries (generator function expression)
esid: sec-generator-function-definitions-runtime-semantics-evaluation
features: [globalThis, Symbol.unscopables, generators]
flags: [generated, noStrict]
info: |
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
[...]
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
GeneratorBody, scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = function*(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
};
ref(10).next();
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,79 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/async-func-decl.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async function declaration)
esid: sec-async-function-definitions
features: [globalThis, Symbol.unscopables, async-functions]
flags: [generated, noStrict, async]
info: |
14.6 Async Function Definitions
AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
async function ref(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
}
ref(10).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,73 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/async-func-decl.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async function declaration)
esid: sec-async-function-definitions
features: [globalThis, Symbol.unscopables, async-functions]
flags: [generated, noStrict, async]
info: |
14.6 Async Function Definitions
AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
async function ref(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
}
ref(10).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,81 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/async-gen-func-decl.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async generator function declaration)
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
features: [globalThis, Symbol.unscopables, async-iteration]
flags: [generated, noStrict, async]
info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
scope, strict).
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
async function* ref(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
}
ref(10).next().then(() => {
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,75 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/async-gen-func-decl.template
/*---
description: Symbol.unscopables behavior across scope boundaries (async generator function declaration)
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
features: [globalThis, Symbol.unscopables, async-iteration]
flags: [generated, noStrict, async]
info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
scope, strict).
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
async function* ref(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
}
ref(10).next().then(() => {
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
}).then($DONE, $DONE);
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,102 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/func-decl.template
/*---
description: Symbol.unscopables behavior across scope boundaries (function declaration)
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
features: [globalThis, Symbol.unscopables]
flags: [generated, noStrict]
info: |
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
[...]
3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
function ref(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
}
ref(10);
assert.sameValue(callCount, 1, 'function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,96 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/func-decl.template
/*---
description: Symbol.unscopables behavior across scope boundaries (function declaration)
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
features: [globalThis, Symbol.unscopables]
flags: [generated, noStrict]
info: |
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
[...]
3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
function ref(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
}
ref(10);
assert.sameValue(callCount, 1, 'function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,102 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with-in-nested-fn.case
// - src/function-forms/default/gen-func-decl.template
/*---
description: Symbol.unscopables behavior across scope boundaries (generator function declaration)
esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
features: [globalThis, Symbol.unscopables, generators]
flags: [generated, noStrict]
info: |
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
[...]
2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
GeneratorBody, scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
function* ref(x) {
(function() {
count++;
with (globalThis) {
count++;
assert.sameValue(v, 1, 'The value of `v` is 1');
}
})();
(function() {
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
})();
assert.sameValue(v, 1, 'The value of `v` is 1');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
}
ref(10).next();
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');

View File

@ -0,0 +1,96 @@
// This file was procedurally generated from the following sources:
// - src/function-forms/unscopables-with.case
// - src/function-forms/default/gen-func-decl.template
/*---
description: Symbol.unscopables behavior across scope boundaries (generator function declaration)
esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
features: [globalThis, Symbol.unscopables, generators]
flags: [generated, noStrict]
info: |
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
[...]
2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
GeneratorBody, scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
...
Let envRec be lex's EnvironmentRecord.
Let exists be ? envRec.HasBinding(name).
HasBinding
...
If the withEnvironment flag of envRec is false, return true.
Let unscopables be ? Get(bindings, @@unscopables).
If Type(unscopables) is Object, then
Let blocked be ToBoolean(? Get(unscopables, N)).
If blocked is true, return false.
(The `with` Statement) Runtime Semantics: Evaluation
...
Set the withEnvironment flag of newEnvs EnvironmentRecord to true.
...
---*/
let count = 0;
var v = 1;
globalThis[Symbol.unscopables] = {
v: true,
};
{
count++;
var callCount = 0;
// Stores a reference `ref` for case evaluation
function* ref(x) {
count++;
with (globalThis) {
count++;
assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
}
count++;
var v = x;
with (globalThis) {
count++;
assert.sameValue(v, 10, 'The value of `v` is 10');
v = 20;
}
assert.sameValue(v, 20, 'The value of `v` is 20');
assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
callCount = callCount + 1;
}
ref(10).next();
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
count++;
}
assert.sameValue(count, 6, 'The value of `count` is 6');