Lines Matching refs:const
28 // Test for const semantics.
121 TestConflict("const x", "var x");
122 TestConflict("const x = 0", "var x");
123 TestConflict("const x", "var x = 0");
124 TestConflict("const x = 0", "var x = 0");
126 TestConflict("var x", "const x");
127 TestConflict("var x = 0", "const x");
128 TestConflict("var x", "const x = 0");
129 TestConflict("var x = 0", "const x = 0");
131 TestConflict("const x = undefined", "var x");
132 TestConflict("const x", "var x = undefined");
133 TestConflict("const x = undefined", "var x = undefined");
135 TestConflict("var x = undefined", "const x");
136 TestConflict("var x", "const x = undefined");
137 TestConflict("var x = undefined", "const x = undefined");
139 TestConflict("const x = undefined", "var x = 0");
140 TestConflict("const x = 0", "var x = undefined");
142 TestConflict("var x = undefined", "const x = 0");
143 TestConflict("var x = 0", "const x = undefined");
145 TestConflict("const x", "function x() { }");
146 TestConflict("const x = 0", "function x() { }");
147 TestConflict("const x = undefined", "function x() { }");
149 TestConflict("function x() { }", "const x");
150 TestConflict("function x() { }", "const x = 0");
151 TestConflict("function x() { }", "const x = undefined");
153 TestConflict("const x, y", "var x");
154 TestConflict("const x, y", "var y");
155 TestConflict("const x = 0, y", "var x");
156 TestConflict("const x = 0, y", "var y");
157 TestConflict("const x, y = 0", "var x");
158 TestConflict("const x, y = 0", "var y");
159 TestConflict("const x = 0, y = 0", "var x");
160 TestConflict("const x = 0, y = 0", "var y");
162 TestConflict("var x", "const x, y");
163 TestConflict("var y", "const x, y");
164 TestConflict("var x", "const x = 0, y");
165 TestConflict("var y", "const x = 0, y");
166 TestConflict("var x", "const x, y = 0");
167 TestConflict("var y", "const x, y = 0");
168 TestConflict("var x", "const x = 0, y = 0");
169 TestConflict("var y", "const x = 0, y = 0");
173 TestConflict("var x, y", "const x, y");
176 // Test that repeated const declarations throw redeclaration errors.
177 TestConflict("const x", "const x");
178 TestConflict("const x = 0", "const x");
179 TestConflict("const x", "const x = 0");
180 TestConflict("const x = 0", "const x = 0");
182 TestConflict("const x = undefined", "const x");
183 TestConflict("const x", "const x = undefined");
184 TestConflict("const x = undefined", "const x = undefined");
186 TestConflict("const x = undefined", "const x = 0");
187 TestConflict("const x = 0", "const x = undefined");
189 TestConflict("const x, y", "const x");
190 TestConflict("const x, y", "const y");
191 TestConflict("const x = 0, y", "const x");
192 TestConflict("const x = 0, y", "const y");
193 TestConflict("const x, y = 0", "const x");
194 TestConflict("const x, y = 0", "const y");
195 TestConflict("const x = 0, y = 0", "const x");
196 TestConflict("const x = 0, y = 0", "const y");
198 TestConflict("const x", "const x, y");
199 TestConflict("const y", "const x, y");
200 TestConflict("const x", "const x = 0, y");
201 TestConflict("const y", "const x = 0, y");
202 TestConflict("const x", "const x, y = 0");
203 TestConflict("const y", "const x, y = 0");
204 TestConflict("const x", "const x = 0, y = 0");
205 TestConflict("const y", "const x = 0, y = 0");
208 // Test that multiple const conflicts do not cause issues.
209 TestConflict("const x, y", "const x, y");
212 // Test that const inside loop behaves correctly.
213 var loop = "for (var i = 0; i < 3; i++) { const x = i; }";
218 // Test that const inside with behaves correctly.
219 TestAll(87, "with ({x:42}) { const x = 87; }", "x");
220 TestAll(undefined, "with ({x:42}) { const x; }", "x");