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

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

Issue 6598023: Strict mode - allow function only in SourceElements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR Feedback. Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 CheckStrictMode("function strict() { var x = ++arguments; }", SyntaxError); 273 CheckStrictMode("function strict() { var x = ++arguments; }", SyntaxError);
274 274
275 // Prefix decrement with eval or arguments 275 // Prefix decrement with eval or arguments
276 CheckStrictMode("function strict() { --eval; }", SyntaxError); 276 CheckStrictMode("function strict() { --eval; }", SyntaxError);
277 CheckStrictMode("function strict() { --arguments; }", SyntaxError); 277 CheckStrictMode("function strict() { --arguments; }", SyntaxError);
278 CheckStrictMode("function strict() { print(--eval); }", SyntaxError); 278 CheckStrictMode("function strict() { print(--eval); }", SyntaxError);
279 CheckStrictMode("function strict() { print(--arguments); }", SyntaxError); 279 CheckStrictMode("function strict() { print(--arguments); }", SyntaxError);
280 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError); 280 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError);
281 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError); 281 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError);
282 282
283 // Strict mode only allows functions in SourceElements
284 CheckStrictMode("if (true) { function invalid() {} }", SyntaxError);
285 CheckStrictMode("for (;false;) { function invalid() {} }", SyntaxError);
286 CheckStrictMode("{ function invalid() {} }", SyntaxError);
287 CheckStrictMode("try { function invalid() {} } catch(e) {}", SyntaxError);
288 CheckStrictMode("try { } catch(e) { function invalid() {} }", SyntaxError);
289 CheckStrictMode("function outer() {{ function invalid() {} }}", SyntaxError);
290
283 // Delete of an unqualified identifier 291 // Delete of an unqualified identifier
284 CheckStrictMode("delete unqualified;", SyntaxError); 292 CheckStrictMode("delete unqualified;", SyntaxError);
285 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError); 293 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError);
286 CheckStrictMode("function function_name() { delete function_name; }", 294 CheckStrictMode("function function_name() { delete function_name; }",
287 SyntaxError); 295 SyntaxError);
288 CheckStrictMode("function strict(parameter) { delete parameter; }", 296 CheckStrictMode("function strict(parameter) { delete parameter; }",
289 SyntaxError); 297 SyntaxError);
290 CheckStrictMode("function strict() { var variable; delete variable; }", 298 CheckStrictMode("function strict() { var variable; delete variable; }",
291 SyntaxError); 299 SyntaxError);
292 CheckStrictMode("var variable; delete variable;", SyntaxError); 300 CheckStrictMode("var variable; delete variable;", SyntaxError);
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 assertEquals(callIndexedNonStrictGet(false), "object"); 701 assertEquals(callIndexedNonStrictGet(false), "object");
694 702
695 } 703 }
696 } finally { 704 } finally {
697 // Cleanup 705 // Cleanup
698 cleanup(String); 706 cleanup(String);
699 cleanup(Number); 707 cleanup(Number);
700 cleanup(Boolean); 708 cleanup(Boolean);
701 } 709 }
702 })(); 710 })();
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698