mirror of https://github.com/tc39/test262.git
Add equivalent tests for fn param-body boundary
These tests are based on the files introduced in the commit titled, "Add tests for Lexical Environment management."
This commit is contained in:
parent
c9a93c1d1c
commit
74d0c1d124
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
((_ = null) => {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
})();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
((_ = probeParams = function() { return x; }) => {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
})();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
var C = class {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
*m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.prototype.m().next();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
var C = class{
|
||||
*m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.prototype.m().next();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
var C = class {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.prototype.m();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
var C = class {
|
||||
m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.prototype.m();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
var C = class {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
set a(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.prototype.a = null;
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
var C = class {
|
||||
set a(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.prototype.a = undefined;
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
var C = class {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
static *m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.m().next();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
var C = class {
|
||||
static *m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.m().next();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
var C = class {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
static m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.m();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
var C = class {
|
||||
static m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.m();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
var C = class {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
static set a(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.a = null;
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
var C = class {
|
||||
static set a(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
};
|
||||
C.a = undefined;
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
(function*(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}().next());
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
(function*(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}().next());
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
({
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
*m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}.m().next());
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
({
|
||||
*m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}.m().next());
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
({
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}.m());
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
({
|
||||
m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}.m());
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
({
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
set a(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}.a = null);
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
({
|
||||
set a(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}.a = undefined);
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
class C {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
*m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.prototype.m().next();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
class C {
|
||||
*m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.prototype.m().next();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
class C {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.prototype.m();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
class C {
|
||||
m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.prototype.m();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
class C {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
set a(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.prototype.a = null;
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
class C {
|
||||
set a(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.prototype.a = undefined;
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
class C {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
static *m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.m().next();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
class C {
|
||||
static *m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.m().next();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
class C {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
static m(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.m();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
class C {
|
||||
static m(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.m();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
class C {
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
static set a(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.a = null;
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
class C {
|
||||
static set a(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
}
|
||||
C.a = undefined;
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
function f(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
f();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
function f(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
f();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Disposal of variable environment for the function body
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var probe;
|
||||
|
||||
// A parameter expression is necessary to trigger the creation of the scope
|
||||
// under test.
|
||||
function* g(_ = null) {
|
||||
var x = 'inside';
|
||||
probe = function() { return x; };
|
||||
}
|
||||
g().next();
|
||||
|
||||
var x = 'outside';
|
||||
|
||||
assert.sameValue(probe(), 'inside');
|
||||
assert.sameValue(x, 'outside');
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-functiondeclarationinstantiation
|
||||
description: >
|
||||
Creation of new variable environment for the function body (as disinct from
|
||||
that for the function's parameters)
|
||||
info: |
|
||||
[...]
|
||||
26. If hasParameterExpressions is false, then
|
||||
[...]
|
||||
27. Else,
|
||||
a. NOTE A separate Environment Record is needed to ensure that closures
|
||||
created by expressions in the formal parameter list do not have
|
||||
visibility of declarations in the function body.
|
||||
b. Let varEnv be NewDeclarativeEnvironment(env).
|
||||
c. Let varEnvRec be varEnv's EnvironmentRecord.
|
||||
d. Set the VariableEnvironment of calleeContext to varEnv.
|
||||
e. Let instantiatedVarNames be a new empty List.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var x = 'outside';
|
||||
var probeParams, probeBody;
|
||||
|
||||
function* g(_ = probeParams = function() { return x; }) {
|
||||
var x = 'inside';
|
||||
probeBody = function() { return x; };
|
||||
}
|
||||
g().next();
|
||||
|
||||
assert.sameValue(probeParams(), 'outside');
|
||||
assert.sameValue(probeBody(), 'inside');
|
Loading…
Reference in New Issue