Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: test/mjsunit/strict-mode.js

Issue 905003003: Rename ParseSourceElements in preparser too (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove kUnknownSourceElements Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/preparser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 CheckStrictMode("function strict() { print(--eval); }", SyntaxError); 285 CheckStrictMode("function strict() { print(--eval); }", SyntaxError);
286 CheckStrictMode("function strict() { print(--arguments); }", SyntaxError); 286 CheckStrictMode("function strict() { print(--arguments); }", SyntaxError);
287 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError); 287 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError);
288 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError); 288 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError);
289 289
290 // Use of const in strict mode is disallowed in anticipation of ES Harmony. 290 // Use of const in strict mode is disallowed in anticipation of ES Harmony.
291 CheckStrictMode("const x = 0;", SyntaxError); 291 CheckStrictMode("const x = 0;", SyntaxError);
292 CheckStrictMode("for (const x = 0; false;) {}", SyntaxError); 292 CheckStrictMode("for (const x = 0; false;) {}", SyntaxError);
293 CheckStrictMode("function strict() { const x = 0; }", SyntaxError); 293 CheckStrictMode("function strict() { const x = 0; }", SyntaxError);
294 294
295 // Strict mode only allows functions in SourceElements 295 // Strict mode only allows functions in StatementList
296 CheckStrictMode("if (true) { function invalid() {} }", SyntaxError); 296 CheckStrictMode("if (true) { function invalid() {} }", SyntaxError);
297 CheckStrictMode("for (;false;) { function invalid() {} }", SyntaxError); 297 CheckStrictMode("for (;false;) { function invalid() {} }", SyntaxError);
298 CheckStrictMode("{ function invalid() {} }", SyntaxError); 298 CheckStrictMode("{ function invalid() {} }", SyntaxError);
299 CheckStrictMode("try { function invalid() {} } catch(e) {}", SyntaxError); 299 CheckStrictMode("try { function invalid() {} } catch(e) {}", SyntaxError);
300 CheckStrictMode("try { } catch(e) { function invalid() {} }", SyntaxError); 300 CheckStrictMode("try { } catch(e) { function invalid() {} }", SyntaxError);
301 CheckStrictMode("function outer() {{ function invalid() {} }}", SyntaxError); 301 CheckStrictMode("function outer() {{ function invalid() {} }}", SyntaxError);
302 302
303 // Delete of an unqualified identifier 303 // Delete of an unqualified identifier
304 CheckStrictMode("delete unqualified;", SyntaxError); 304 CheckStrictMode("delete unqualified;", SyntaxError);
305 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError); 305 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError);
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 assertSame(null, test(i)); 1212 assertSame(null, test(i));
1213 } 1213 }
1214 })(); 1214 })();
1215 1215
1216 1216
1217 (function TestStrictModeEval() { 1217 (function TestStrictModeEval() {
1218 "use strict"; 1218 "use strict";
1219 eval("var eval_local = 10;"); 1219 eval("var eval_local = 10;");
1220 assertThrows(function() { return eval_local; }, ReferenceError); 1220 assertThrows(function() { return eval_local; }, ReferenceError);
1221 })(); 1221 })();
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698