Index: test/mjsunit/strict-mode.js |
diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js |
index 14c00e9d434b77af7e21cc7318401c950db3a8c3..866a67250df70803bd77e7238c0a2f8f829bf124 100644 |
--- a/test/mjsunit/strict-mode.js |
+++ b/test/mjsunit/strict-mode.js |
@@ -145,8 +145,6 @@ function StrictModeNonDuplicate() { |
var x = { 123: 1, '123.00000000000000000000000000000000000000000000000000000000000000000001' : 2 } |
} |
-//CheckStrictMode("", SyntaxError) |
- |
// Two getters (non-strict) |
assertThrows("var x = { get foo() { }, get foo() { } };", SyntaxError) |
assertThrows("var x = { get foo(){}, get 'foo'(){}};", SyntaxError) |
@@ -178,3 +176,65 @@ assertThrows("var x = { 'foo': 'data', get foo() { } };", SyntaxError) |
assertThrows("var x = { get 'foo'() { }, 'foo': 'data' };", SyntaxError) |
assertThrows("var x = { '12': 1, get '12'(){}};", SyntaxError); |
assertThrows("var x = { '12': 1, get 12(){}};", SyntaxError); |
+ |
+// Assignment to eval or arguments |
+CheckStrictMode("function strict() { eval = undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { arguments = undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { print(eval = undefined); }", SyntaxError) |
+CheckStrictMode("function strict() { print(arguments = undefined); }", SyntaxError) |
+CheckStrictMode("function strict() { var x = eval = undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { var x = arguments = undefined; }", SyntaxError) |
+ |
+// Compound assignment to eval or arguments |
+CheckStrictMode("function strict() { eval *= undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { arguments /= undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { print(eval %= undefined); }", SyntaxError) |
+CheckStrictMode("function strict() { print(arguments %= undefined); }", SyntaxError) |
+CheckStrictMode("function strict() { var x = eval += undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { var x = arguments -= undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { eval <<= undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { arguments >>= undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { print(eval >>>= undefined); }", SyntaxError) |
+CheckStrictMode("function strict() { print(arguments &= undefined); }", SyntaxError) |
+CheckStrictMode("function strict() { var x = eval ^= undefined; }", SyntaxError) |
+CheckStrictMode("function strict() { var x = arguments |= undefined; }", SyntaxError) |
+ |
+// Postfix increment with eval or arguments |
+CheckStrictMode("function strict() { eval++; }", SyntaxError) |
+CheckStrictMode("function strict() { arguments++; }", SyntaxError) |
+CheckStrictMode("function strict() { print(eval++); }", SyntaxError) |
+CheckStrictMode("function strict() { print(arguments++); }", SyntaxError) |
+CheckStrictMode("function strict() { var x = eval++; }", SyntaxError) |
+CheckStrictMode("function strict() { var x = arguments++; }", SyntaxError) |
+ |
+// Postfix decrement with eval or arguments |
+CheckStrictMode("function strict() { eval--; }", SyntaxError) |
+CheckStrictMode("function strict() { arguments--; }", SyntaxError) |
+CheckStrictMode("function strict() { print(eval--); }", SyntaxError) |
+CheckStrictMode("function strict() { print(arguments--); }", SyntaxError) |
+CheckStrictMode("function strict() { var x = eval--; }", SyntaxError) |
+CheckStrictMode("function strict() { var x = arguments--; }", SyntaxError) |
+ |
+// Prefix increment with eval or arguments |
+CheckStrictMode("function strict() { ++eval; }", SyntaxError) |
+CheckStrictMode("function strict() { ++arguments; }", SyntaxError) |
+CheckStrictMode("function strict() { print(++eval); }", SyntaxError) |
+CheckStrictMode("function strict() { print(++arguments); }", SyntaxError) |
+CheckStrictMode("function strict() { var x = ++eval; }", SyntaxError) |
+CheckStrictMode("function strict() { var x = ++arguments; }", SyntaxError) |
+ |
+// Prefix decrement with eval or arguments |
+CheckStrictMode("function strict() { --eval; }", SyntaxError) |
+CheckStrictMode("function strict() { --arguments; }", SyntaxError) |
+CheckStrictMode("function strict() { print(--eval); }", SyntaxError) |
+CheckStrictMode("function strict() { print(--arguments); }", SyntaxError) |
+CheckStrictMode("function strict() { var x = --eval; }", SyntaxError) |
+CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError) |
+ |
+// Prefix unary operators other than delete, ++, -- are valid in strict mode |
+function StrictModeUnaryOperators() { |
+ "use strict"; |
+ var x = [void eval, typeof eval, +eval, -eval, ~eval, !eval]; |
+ var y = [void arguments, typeof arguments, |
+ +arguments, -arguments, ~arguments, !arguments]; |
+} |