Debian Codegraph @

rhino/testsrc/doctests/784358.doctest

raw
1 // This Source Code Form is subject to the terms of the Mozilla Public
2 // License, v. 2.0. If a copy of the MPL was not distributed with this
3 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 // https://bugzilla.mozilla.org/show_bug.cgi?id=784358
6
7 js> var v1=1
8 js> v1
9 1
10 js> eval("var v2=1")
11 js> v2
12 1
13 js> const c1=1
14 js> c1
15 1
16 js> eval("const c2=1")
17 js> c2
18 1
19 js> try {eval("const v1=2")}catch(e){e instanceof TypeError}
20 true
21 js> try {eval("const v1=2")}catch(e){e instanceof TypeError}
22 true
23 js> try{eval("const c1=1")}catch(e){e instanceof TypeError}
24 true
25 js> try{eval("const c2=1")}catch(e){e instanceof TypeError}
26 true
27 js> try{eval("var c1=1")}catch(e){e instanceof TypeError}
28 true
29 js> try{eval("var c2=1")}catch(e){e instanceof TypeError}
30 true
31 js> try {(1,eval)("const v1=2")}catch(e){e instanceof TypeError}
32 true
33 js> try {(1,eval)("const v1=2")}catch(e){e instanceof TypeError}
34 true
35 js> try{(1,eval)("const c1=1")}catch(e){e instanceof TypeError}
36 true
37 js> try{(1,eval)("const c2=1")}catch(e){e instanceof TypeError}
38 true
39 js> try{(1,eval)("var c1=1")}catch(e){e instanceof TypeError}
40 true
41 js> try{(1,eval)("var c2=1")}catch(e){e instanceof TypeError}
42 true
43 js> (function(){eval("const v1=2"); return v1})()
44 2
45 js> (function(){eval("const v2=2"); return v2})()
46 2
47 js> (function(){eval("const c1=2"); return c1})()
48 2
49 js> (function(){eval("const c2=2"); return c2})()
50 2
51 js> (function(){eval("var c1=2"); return c1})()
52 2
53 js> (function(){eval("var c2=2"); return c2})()
54 2
55 js> try{ (function(){(1,eval)("const v1=1")})() }catch(e){e instanceof TypeError}
56 true
57 js> try{ (function(){(1,eval)("const v2=1")})() }catch(e){e instanceof TypeError}
58 true
59 js> try{ (function(){(1,eval)("const c1=1")})() }catch(e){e instanceof TypeError}
60 true
61 js> try{ (function(){(1,eval)("const c2=1")})() }catch(e){e instanceof TypeError}
62 true
63 js> try{ (function(){(1,eval)("var c1=1")})() }catch(e){e instanceof TypeError}
64 true
65 js> try{ (function(){(1,eval)("var c2=1")})() }catch(e){e instanceof TypeError}
66 true
67 js> (v1 = 3, v1)
68 3
69 js> (v2 = 3, v2)
70 3
71 js> (c1 = 3, c1)
72 1
73 js> (c2 = 3, c2)
74 1
75 js> delete v1
76 false
77 js> delete v2
78 true
79 js> delete c1
80 false
81 js> delete c2
82 false
83 js> try{ (function(){const c1=1; eval("const c1=1")})() }catch(e){e instanceof TypeError}
84 true
85 js> try{ (function(){eval("const c1=1"); const c1=1})() }catch(e){e instanceof TypeError}
86 true
87 js> try{ (function(){eval("const c1=1"); eval("const c1=1")})() }catch(e){e instanceof TypeError}
88 true
89 js> try{ (function(){const c1=1; eval("var c1=1")})() }catch(e){e instanceof TypeError}
90 true
91 js> try{ (function(){eval("var c1=1"); const c1=1})() }catch(e){e instanceof TypeError}
92 true
93 js> try{ (function(){var c1=1; eval("const c1=1")})() }catch(e){e instanceof TypeError}
94 true