Debian Codegraph @

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