author | hannesw |
Thu, 04 Sep 2014 15:37:14 +0200 | |
changeset 26377 | 028dad61662f |
child 29281 | 8cc2618a07aa |
permissions | -rw-r--r-- |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
1 |
/* |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
2 |
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
4 |
* |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
8 |
* |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
13 |
* accompanied this code). |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
14 |
* |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
18 |
* |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
21 |
* questions. |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
22 |
*/ |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
23 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
24 |
/** |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
25 |
* JDK-8051889: Implement block scoping in symbol assignment and scope computation |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
26 |
* |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
27 |
* @test |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
28 |
* @run |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
29 |
* @option --language=es6 */ |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
30 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
31 |
"use strict"; |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
32 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
33 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
34 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
35 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
36 |
'x = 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
37 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
38 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
39 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
40 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
41 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
42 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
43 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
44 |
'x++;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
45 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
46 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
47 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
48 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
49 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
50 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
51 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
52 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
53 |
'x--;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
54 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
55 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
56 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
57 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
58 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
59 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
60 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
61 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
62 |
'++x;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
63 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
64 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
65 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
66 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
67 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
68 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
69 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
70 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
71 |
'--x;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
72 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
73 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
74 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
75 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
76 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
77 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
78 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
79 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
80 |
'x += 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
81 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
82 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
83 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
84 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
85 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
86 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
87 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
88 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
89 |
'x *= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
90 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
91 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
92 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
93 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
94 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
95 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
96 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
97 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
98 |
'x /= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
99 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
100 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
101 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
102 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
103 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
104 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
105 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
106 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
107 |
'x %= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
108 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
109 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
110 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
111 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
112 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
113 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
114 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
115 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
116 |
'x |= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
117 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
118 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
119 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
120 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
121 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
122 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
123 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
124 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
125 |
'x &= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
126 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
127 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
128 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
129 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
130 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
131 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
132 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
133 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
134 |
'x ^= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
135 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
136 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
137 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
138 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
139 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
140 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
141 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
142 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
143 |
'x <<= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
144 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
145 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
146 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
147 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
148 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
149 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
150 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
151 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
152 |
'x >>= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
153 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
154 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
155 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
156 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
157 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
158 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
159 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
160 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
161 |
'x >>>= 1;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
162 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
163 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
164 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
165 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
166 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
167 |
try { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
168 |
eval('"use strict";\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
169 |
'const x = 2;\n' + |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
170 |
'delete x;\n'); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
171 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
172 |
} catch (e) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
173 |
print(e.name); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
174 |
} |