Debian Codegraph @

js/src/tests/test262/annexB/language/global-code/if-decl-no-else-global-init.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/annex-b-fns/global-init.case
3 // - src/annex-b-fns/global/if-decl-no-else.template
4 /*---
5 description: Variable binding is initialized to `undefined` in outer scope (IfStatement without an else clause in the global scope)
6 esid: sec-functiondeclarations-in-ifstatement-statement-clauses
7 flags: [generated, noStrict]
8 includes: [fnGlobalObject.js, propertyHelper.js]
9 info: |
10 The following rules for IfStatement augment those in 13.6:
11
12 IfStatement[Yield, Return]:
13 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
14 if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
15 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
16 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
17
18
19 B.3.3.2 Changes to GlobalDeclarationInstantiation
20
21 [...]
22 b. If declaredFunctionOrVarNames does not contain F, then
23 i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false).
24 ii. Append F to declaredFunctionOrVarNames.
25 [...]
26
27 ---*/
28 var global = fnGlobalObject();
29 assert.sameValue(f, undefined, 'binding is initialized to `undefined`');
30
31 verifyProperty(global, "f", {
32 enumerable: true,
33 writable: true,
34 configurable: false
35 });
36
37 if (true) function f() { }
38
39 reportCompare(0, 0);