OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 with ({}) {}; | 143 with ({}) {}; |
144 } | 144 } |
145 | 145 |
146 // Octal literal | 146 // Octal literal |
147 CheckStrictMode("var x = 012"); | 147 CheckStrictMode("var x = 012"); |
148 CheckStrictMode("012"); | 148 CheckStrictMode("012"); |
149 CheckStrictMode("'Hello octal\\032'"); | 149 CheckStrictMode("'Hello octal\\032'"); |
150 CheckStrictMode("function octal() { return 012; }"); | 150 CheckStrictMode("function octal() { return 012; }"); |
151 CheckStrictMode("function octal() { return '\\032'; }"); | 151 CheckStrictMode("function octal() { return '\\032'; }"); |
152 | 152 |
153 function ValidEscape() { | |
154 "use strict"; | |
155 var x = '\0'; | |
156 var y = "\0"; | |
157 } | |
158 | |
Lasse Reichstein
2011/01/31 06:05:19
If the preparser marks this function as lazy (whic
Martin Maly
2011/01/31 22:44:06
Done. The pereparser work is on my todo list.
| |
153 // Octal before "use strict" | 159 // Octal before "use strict" |
154 assertThrows('\ | 160 assertThrows('\ |
155 function strict() {\ | 161 function strict() {\ |
156 "octal\\032directive";\ | 162 "octal\\032directive";\ |
157 "use strict";\ | 163 "use strict";\ |
158 }', SyntaxError); | 164 }', SyntaxError); |
159 | 165 |
160 // Duplicate data properties. | 166 // Duplicate data properties. |
161 CheckStrictMode("var x = { dupe : 1, nondupe: 3, dupe : 2 };", SyntaxError) | 167 CheckStrictMode("var x = { dupe : 1, nondupe: 3, dupe : 2 };", SyntaxError) |
162 CheckStrictMode("var x = { '1234' : 1, '2345' : 2, '1234' : 3 };", SyntaxError) | 168 CheckStrictMode("var x = { '1234' : 1, '2345' : 2, '1234' : 3 };", SyntaxError) |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError) | 264 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError) |
259 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError) | 265 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError) |
260 | 266 |
261 // Prefix unary operators other than delete, ++, -- are valid in strict mode | 267 // Prefix unary operators other than delete, ++, -- are valid in strict mode |
262 function StrictModeUnaryOperators() { | 268 function StrictModeUnaryOperators() { |
263 "use strict"; | 269 "use strict"; |
264 var x = [void eval, typeof eval, +eval, -eval, ~eval, !eval]; | 270 var x = [void eval, typeof eval, +eval, -eval, ~eval, !eval]; |
265 var y = [void arguments, typeof arguments, | 271 var y = [void arguments, typeof arguments, |
266 +arguments, -arguments, ~arguments, !arguments]; | 272 +arguments, -arguments, ~arguments, !arguments]; |
267 } | 273 } |
OLD | NEW |