| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/annex-b-fns/func-update.case |
| 3 |
// - src/annex-b-fns/func/block.template |
| 4 |
/*--- |
| 5 |
description: Variable binding value is updated following evaluation (Block statement in function scope containing a function declaration) |
| 6 |
esid: sec-web-compat-functiondeclarationinstantiation |
| 7 |
es6id: B.3.3.1 |
| 8 |
flags: [generated, noStrict] |
| 9 |
info: | |
| 10 |
B.3.3.1 Changes to FunctionDeclarationInstantiation |
| 11 |
|
| 12 |
[...] |
| 13 |
3. When the FunctionDeclaration f is evaluated, perform the following steps |
| 14 |
in place of the FunctionDeclaration Evaluation algorithm provided in |
| 15 |
14.1.21: |
| 16 |
a. Let fenv be the running execution context's VariableEnvironment. |
| 17 |
b. Let fenvRec be fenv's EnvironmentRecord. |
| 18 |
c. Let benv be the running execution context's LexicalEnvironment. |
| 19 |
d. Let benvRec be benv's EnvironmentRecord. |
| 20 |
e. Let fobj be ! benvRec.GetBindingValue(F, false). |
| 21 |
f. Perform ! fenvRec.SetMutableBinding(F, fobj, false). |
| 22 |
g. Return NormalCompletion(empty). |
| 23 |
---*/ |
| 24 |
var after; |
| 25 |
|
| 26 |
(function() { |
| 27 |
|
| 28 |
|
| 29 |
{ |
| 30 |
function f() { return 'declaration'; } |
| 31 |
} |
| 32 |
|
| 33 |
after = f; |
| 34 |
}()); |
| 35 |
|
| 36 |
assert.sameValue(typeof after, 'function'); |
| 37 |
assert.sameValue(after(), 'declaration'); |