author | hannesw |
Fri, 27 Feb 2015 14:33:47 +0100 | |
changeset 29281 | 8cc2618a07aa |
parent 26377 | 028dad61662f |
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 { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
34 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
35 |
x = 1; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
36 |
fail("const assignment didn't throw"); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
37 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
38 |
print(e); |
26377
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 { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
42 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
43 |
x++; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
44 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
45 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
46 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
47 |
} |
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 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
50 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
51 |
x--; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
52 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
53 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
54 |
print(e); |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
55 |
} |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
56 |
|
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
57 |
try { |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
58 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
59 |
++x; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
60 |
fail("const assignment didn't throw"); |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
61 |
} catch (e) { |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
62 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
63 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
64 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
65 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
66 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
67 |
--x; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
68 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
69 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
70 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
71 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
72 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
73 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
74 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
75 |
x += 1; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
76 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
77 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
78 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
79 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
80 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
81 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
82 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
83 |
x *= 1; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
84 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
85 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
86 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
87 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
88 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
89 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
90 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
91 |
x /= 1; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
92 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
93 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
94 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
95 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
96 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
97 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
98 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
99 |
x %= 1; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
100 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
101 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
102 |
print(e); |
26377
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 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
105 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
106 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
107 |
x |= 1; |
26377
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) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
110 |
print(e); |
26377
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 { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
114 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
115 |
x &= 1; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
116 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
117 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
118 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
119 |
} |
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 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
122 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
123 |
x ^= 1; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
124 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
125 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
126 |
print(e); |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
127 |
} |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
128 |
|
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
129 |
try { |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
130 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
131 |
x <<= 1; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
132 |
fail("const assignment didn't throw"); |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
133 |
} catch (e) { |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
134 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
135 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
136 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
137 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
138 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
139 |
x >>= 1; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
140 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
141 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
142 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
143 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
144 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
145 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
146 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
147 |
x >>>= 1; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
148 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
149 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
150 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
151 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
152 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
153 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
154 |
const x = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
155 |
delete x; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
156 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
157 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
158 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
159 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
160 |
|
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
161 |
const c = 1; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
162 |
|
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
163 |
try { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
164 |
c = 2; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
165 |
fail("const assignment didn't throw"); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
166 |
} catch (e) { |
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
167 |
print(e); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
168 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
diff
changeset
|
169 |
|
29281
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
170 |
(function() { |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
171 |
try { |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
172 |
c = 2; |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
173 |
fail("const assignment didn't throw"); |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
174 |
} catch (e) { |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
175 |
print(e); |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
176 |
} |
8cc2618a07aa
8073707: const re-assignment should not reported as a early error
hannesw
parents:
26377
diff
changeset
|
177 |
})(); |