Debian Codegraph @

rhino/testsrc/tests/js1_7/decompilation/regress-356247.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-356247.js';
7
8 //-----------------------------------------------------------------------------
9 var BUGNUMBER = 356247;
10 var summary = 'Decompilation of let {} = [1] in a loop';
11 var summarytrunk = 'let declaration must be direct child of block or top-level implicit block';
12 var actual = '';
13 var expect = '';
14
15
16 //-----------------------------------------------------------------------------
17 test();
18 //-----------------------------------------------------------------------------
19
20 function test()
21 {
22 enterFunc ('test');
23 printBugNumber(BUGNUMBER);
24 printStatus (summary);
25
26 var c;
27 var f;
28 var g;
29
30 try
31 {
32 c = '(function() { for(let x in []) let {} = [1]; })';
33 f = eval(c);
34 expect = 'function() { for(let x in []) let [] = [1]; }';
35 actual = f + '';
36 compareSource(expect, actual, summary + ': f : ' + c);
37
38 g = eval('(' + f + ')');
39 actual = g + '';
40 compareSource(expect, actual, summary + ': g : ' + c);
41 }
42 catch(ex)
43 {
44 // See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
45 expect = 'SyntaxError';
46 actual = ex.name;
47 reportCompare(expect, actual, summarytrunk + ': ' + c);
48 }
49
50 try
51 {
52 c = '(function() { while(0) let {} = [1]; })';
53 f = eval(c);
54 expect = 'function() { while(0) let [] = [1]; }';
55 actual = f + '';
56 compareSource(expect, actual, summary + ': f : ' + c);
57
58 g = eval('(' + f + ')');
59 actual = g + '';
60 compareSource(expect, actual, summary + ': g : ' + c);
61 }
62 catch(ex)
63 {
64 // See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
65 expect = 'SyntaxError';
66 actual = ex.name;
67 reportCompare(expect, actual, summarytrunk + ': ' + c);
68 }
69
70 exitFunc ('test');
71 }