1 // This file was procedurally generated from the following sources:
2 // - src/annex-b-fns/eval-global-existing-var-update.case
3 // - src/annex-b-fns/eval-global/direct-block.template
5 description: Variable-scoped binding is updated following evaluation (Block statement in eval code containing a function declaration)
6 esid: sec-web-compat-evaldeclarationinstantiation
7 flags: [generated, noStrict]
9 B.3.3.3 Changes to EvalDeclarationInstantiation
12 b. When the FunctionDeclaration f is evaluated, perform the following steps
13 in place of the FunctionDeclaration Evaluation algorithm provided in
15 i. Let genv be the running execution context's VariableEnvironment.
16 ii. Let genvRec be genv's EnvironmentRecord.
17 iii. Let benv be the running execution context's LexicalEnvironment.
18 iv. Let benvRec be benv's EnvironmentRecord.
19 v. Let fobj be ! benvRec.GetBindingValue(F, false).
20 vi. Perform ? genvRec.SetMutableBinding(F, fobj, false).
21 vii. Return NormalCompletion(empty).
25 '{ function f() { return "function declaration"; } }'
28 assert.sameValue(typeof f, 'function');
29 assert.sameValue(f(), 'function declaration');