Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-452742-02.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-452742-02.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 452742;
9 var summary = 'Do not do overzealous eval inside function optimization in BindNameToSlot';
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 = '';
25
26 var obj = { arguments: [-100] };
27
28 function a()
29 {
30 with (obj) { return eval("arguments[0]"); }
31 }
32
33 function b()
34 {
35 var result;
36 eval('with (obj) { result = eval("arguments[0]"); };');
37 return result;
38 }
39
40 try
41 {
42 var result = a();
43 if (result !== -100)
44 throw "Bad result " + result;
45
46 var result = b();
47 if (result !== -100)
48 throw "Bad result " + result;
49 }
50 catch(ex)
51 {
52 actual = ex + '';
53 }
54 reportCompare(expect, actual, summary);
55
56 exitFunc ('test');
57 }