Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-452742-01.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-01.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 = actual = 'No Error';
25
26 var obj = { x: -100 };
27
28 function a(x)
29 {
30 var orig_x = x;
31 var orig_obj_x = obj.x;
32
33 with (obj) { eval("x = x + 10"); }
34
35 if (x !== orig_x)
36 throw "Unexpected mutation of x: " + x;
37 if (obj.x !== orig_obj_x + 10)
38 throw "Unexpected mutation of obj.x: " + obj.x;
39 }
40
41 try
42 {
43 a(0);
44 }
45 catch(ex)
46 {
47 actual = ex + '';
48 }
49 reportCompare(expect, actual, summary);
50
51 exitFunc ('test');
52 }