Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-existing-global-init.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/annex-b-fns/eval-global-existing-global-init.case
3 // - src/annex-b-fns/eval-global/indirect-if-decl-else-stmt.template
4 /*---
5 description: Variable binding is set to `undefined` (IfStatement with a declaration in the first statement position in eval code)
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.3 Changes to EvalDeclarationInstantiation
21
22 [...]
23 i. If varEnvRec is a global Environment Record, then
24 i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true).
25 [...]
26
27 8.1.1.4.18 CreateGlobalFunctionBinding
28
29 [...]
30 5. If existingProp is undefined or existingProp.[[Configurable]] is true,
31 then
32 [...]
33 6. Else,
34 a. Let desc be the PropertyDescriptor{[[Value]]: V }.
35 [...]
36
37 ---*/
38 Object.defineProperty(fnGlobalObject(), 'f', {
39 value: 'x',
40 enumerable: true,
41 writable: true,
42 configurable: false
43 });
44
45 (0,eval)(
46 'var global = fnGlobalObject();\
47 assert.sameValue(f, undefined, "binding is initialized to `undefined`");\
48 \
49 verifyProperty(global, "f", {\
50 enumerable: true,\
51 writable: true,\
52 configurable: false\
53 });if (true) function f() { } else ;'
54 );