Debian Codegraph @

rhino/testsrc/tests/js1_7/extensions/regress-346642-06.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = 'regress-346642-06.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 346642;
9 var summary = 'decompilation of destructuring assignment';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 expect = 3;
25 actual = '';
26 "" + function() { [] = 3 }; actual = 3;
27 actual = 3;
28 reportCompare(expect, actual, summary + ': 1');
29
30 try
31 {
32 var z = 6;
33 var f = eval('(function (){for(let [] = []; false;) let z; return z})');
34 expect = f();
35 actual = eval("("+f+")")()
36 reportCompare(expect, actual, summary + ': 2');
37 }
38 catch(ex)
39 {
40 // See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
41 var summarytrunk = 'let declaration must be direct child of block or top-level implicit block';
42 expect = 'SyntaxError';
43 actual = ex.name;
44 reportCompare(expect, actual, summarytrunk);
45 }
46
47 expect = 3;
48 actual = '';
49 "" + function () { for(;; [[a]] = [5]) { } }; actual = 3;
50 reportCompare(expect, actual, summary + ': 3');
51
52 expect = 3;
53 actual = '';
54 f = function () { return { set x([a]) { yield; } } }
55 var obj = f();
56 uneval(obj); actual = 3;
57 reportCompare(expect, actual, summary + ': 4');
58
59 expect = 3;
60 actual = '';
61 "" + function () { [y([a]=b)] = z }; actual = 3;
62 reportCompare(expect, actual, summary + ': 5');
63
64 expect = 3;
65 actual = '';
66 "" + function () { for(;; ([[,]] = p)) { } }; actual = 3;
67 reportCompare(expect, actual, summary + ': 6');
68
69 expect = 3;
70 actual = '';
71 actual = 1; try {for(x in (function ([y]) { })() ) { }}catch(ex){} actual = 3;
72 reportCompare(expect, actual, summary + ': 7');
73
74 exitFunc ('test');
75 }