Index: test/mjsunit/strict-mode.js |
diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js |
index ab3e535ec33055a8245ff5280c8b196a74170d3c..7ea0a73286257547a919c29ae8aa85f961fd753e 100644 |
--- a/test/mjsunit/strict-mode.js |
+++ b/test/mjsunit/strict-mode.js |
@@ -280,6 +280,14 @@ CheckStrictMode("function strict() { print(--arguments); }", SyntaxError); |
CheckStrictMode("function strict() { var x = --eval; }", SyntaxError); |
CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError); |
+// Strict mode only allows functions in SourceElements |
+CheckStrictMode("if (true) { function invalid() {} }", SyntaxError); |
+CheckStrictMode("for (;false;) { function invalid() {} }", SyntaxError); |
+CheckStrictMode("{ function invalid() {} }", SyntaxError); |
+CheckStrictMode("try { function invalid() {} } catch(e) {}", SyntaxError); |
+CheckStrictMode("try { } catch(e) { function invalid() {} }", SyntaxError); |
+CheckStrictMode("function outer() {{ function invalid() {} }}", SyntaxError); |
+ |
// Delete of an unqualified identifier |
CheckStrictMode("delete unqualified;", SyntaxError); |
CheckStrictMode("function strict() { delete unqualified; }", SyntaxError); |