Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/annexB/language/function-code/block-decl-func-skip-early-err-try.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/annex-b-fns/func-skip-early-err-try.case
3 // - src/annex-b-fns/func/block.template
4 /*---
5 description: Extension is observed when creation of variable binding would not produce an early error (try statement) (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 2. If instantiatedVarNames does not contain F, then
14 a. Perform ! varEnvRec.CreateMutableBinding(F, false).
15 b. Perform varEnvRec.InitializeBinding(F, undefined).
16 c. Append F to instantiatedVarNames.
17 [...]
18
19 B.3.5 VariableStatements in Catch Blocks
20
21 [...]
22 - It is a Syntax Error if any element of the BoundNames of CatchParameter
23 also occurs in the VarDeclaredNames of Block unless CatchParameter is
24 CatchParameter:BindingIdentifier and that element is only bound by a
25 VariableStatement, the VariableDeclarationList of a for statement, or the
26 ForBinding of a for-in statement.
27 ---*/
28
29 (function() {
30 assert.throws(ReferenceError, function() {
31 f;
32 }, 'An initialized binding is not created prior to evaluation');
33 assert.sameValue(
34 typeof f,
35 'undefined',
36 'An uninitialized binding is not created prior to evaluation'
37 );
38
39 try {
40 throw {};
41 } catch ({ f }) {
42
43 {
44 function f() { }
45 }
46
47 }
48
49 assert.throws(ReferenceError, function() {
50 f;
51 }, 'An initialized binding is not created following evaluation');
52 assert.sameValue(
53 typeof f,
54 'undefined',
55 'An uninitialized binding is not created following evaluation'
56 );
57 }());