Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/annexB/language/global-code/if-decl-else-decl-b-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-else-decl-b.template
4 /*---
5 description: Variable binding is initialized to `undefined` in outer scope (IfStatement with a declaration in both statement positions in the global scope)
6 esid: sec-functiondeclarations-in-ifstatement-statement-clauses
7 es6id: B.3.4
8 flags: [generated, noStrict]
9 includes: [fnGlobalObject.js, propertyHelper.js]
10 info: |
11 The following rules for IfStatement augment those in 13.6:
12
13 IfStatement[Yield, Return]:
14 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
15 if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
16 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
17 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
18
19
20 B.3.3.2 Changes to GlobalDeclarationInstantiation
21
22 [...]
23 b. If declaredFunctionOrVarNames does not contain F, then
24 i. Perform ? envRec.CreateGlobalFunctionBinding(F, undefined, false).
25 ii. Append F to declaredFunctionOrVarNames.
26 [...]
27
28 ---*/
29 var global = fnGlobalObject();
30 assert.sameValue(f, undefined, 'binding is initialized to `undefined`');
31
32 verifyProperty(global, "f", {
33 enumerable: true,
34 writable: true,
35 configurable: false
36 });
37
38 if (false) function _f() {} else function f() { }