Home | History | Annotate | Download | only in mjsunit

Lines Matching refs:strict

24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 assertThrows("'use strict';\n" + code, exception);
31 assertThrows('"use strict";\n' + code, exception);
40 'use strict';\
52 // Create non-strict function. No exception.
57 // Create strict mode function. Exception expected.
58 args[arguments.length] = "'use strict';";
64 // Incorrect 'use strict' directive.
70 // Incorrectly place 'use strict' directive.
71 assertThrows("function foo (x) 'use strict'; {}", SyntaxError);
73 // 'use strict' in non-directive position.
76 "use strict";
80 // Multiple directives, including "use strict".
84 "use strict";\
85 "directive after strict";\
89 // 'with' disallowed in strict mode.
135 // Strict mode applies to the function in which the directive is used..
138 "use strict";\
141 // Strict mode doesn't affect the outer stop of strict code.
143 function Strict() {
144 "use strict";
157 "use strict";
162 // Octal before "use strict"
164 function strict() {\
166 "use strict";\
182 "use strict";
191 // Two getters (non-strict)
196 // Two setters (non-strict)
201 // Setter and data (non-strict)
215 // Getter and data (non-strict)
224 CheckStrictMode("function strict() { eval = undefined; }", SyntaxError);
225 CheckStrictMode("function strict() { arguments = undefined; }", SyntaxError);
226 CheckStrictMode("function strict() { print(eval = undefined); }", SyntaxError);
227 CheckStrictMode("function strict() { print(arguments = undefined); }",
229 CheckStrictMode("function strict() { var x = eval = undefined; }", SyntaxError);
230 CheckStrictMode("function strict() { var x = arguments = undefined; }",
234 CheckStrictMode("function strict() { eval *= undefined; }", SyntaxError);
235 CheckStrictMode("function strict() { arguments /= undefined; }", SyntaxError);
236 CheckStrictMode("function strict() { print(eval %= undefined); }", SyntaxError);
237 CheckStrictMode("function strict() { print(arguments %= undefined); }",
239 CheckStrictMode("function strict() { var x = eval += undefined; }",
241 CheckStrictMode("function strict() { var x = arguments -= undefined; }",
243 CheckStrictMode("function strict() { eval <<= undefined; }", SyntaxError);
244 CheckStrictMode("function strict() { arguments >>= undefined; }", SyntaxError);
245 CheckStrictMode("function strict() { print(eval >>>= undefined); }",
247 CheckStrictMode("function strict() { print(arguments &= undefined); }",
249 CheckStrictMode("function strict() { var x = eval ^= undefined; }",
251 CheckStrictMode("function strict() { var x = arguments |= undefined; }",
255 CheckStrictMode("function strict() { eval++; }", SyntaxError);
256 CheckStrictMode("function strict() { arguments++; }", SyntaxError);
257 CheckStrictMode("function strict() { print(eval++); }", SyntaxError);
258 CheckStrictMode("function strict() { print(arguments++); }", SyntaxError);
259 CheckStrictMode("function strict() { var x = eval++; }", SyntaxError);
260 CheckStrictMode("function strict() { var x = arguments++; }", SyntaxError);
263 CheckStrictMode("function strict() { eval--; }", SyntaxError);
264 CheckStrictMode("function strict() { arguments--; }", SyntaxError);
265 CheckStrictMode("function strict() { print(eval--); }", SyntaxError);
266 CheckStrictMode("function strict() { print(arguments--); }", SyntaxError);
267 CheckStrictMode("function strict() { var x = eval--; }", SyntaxError);
268 CheckStrictMode("function strict() { var x = arguments--; }", SyntaxError);
271 CheckStrictMode("function strict() { ++eval; }", SyntaxError);
272 CheckStrictMode("function strict() { ++arguments; }", SyntaxError);
273 CheckStrictMode("function strict() { print(++eval); }", SyntaxError);
274 CheckStrictMode("function strict() { print(++arguments); }", SyntaxError);
275 CheckStrictMode("function strict() { var x = ++eval; }", SyntaxError);
276 CheckStrictMode("function strict() { var x = ++arguments; }", SyntaxError);
279 CheckStrictMode("function strict() { --eval; }", SyntaxError);
280 CheckStrictMode("function strict() { --arguments; }", SyntaxError);
281 CheckStrictMode("function strict() { print(--eval); }", SyntaxError);
282 CheckStrictMode("function strict() { print(--arguments); }", SyntaxError);
283 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError);
284 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError);
286 // Use of const in strict mode is disallowed in anticipation of ES Harmony.
289 CheckStrictMode("function strict() { const x = 0; }", SyntaxError);
291 // Strict mode only allows functions in SourceElements
301 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError);
304 CheckStrictMode("function strict(parameter) { delete parameter; }",
306 CheckStrictMode("function strict() { var variable; delete variable; }",
311 "use strict";
312 // "delete this" is allowed in strict mode and should work.
317 // Prefix unary operators other than delete, ++, -- are valid in strict mode
319 "use strict";
325 // 7.6.1.2 Future Reserved Words in strict mode
346 eval("var x = { get " + word + " () { 'use strict'; } };");
347 eval("var x = { set " + word + " (value) { 'use strict'; } };");
353 eval("var x = { get '" + word + "' () { 'use strict'; } };");
354 eval("var x = { set '" + word + "' (value) { 'use strict'; } };");
356 // Function names and arguments, strict and non-strict contexts
365 // Function names and arguments when the body is strict
366 assertThrows("function " + word + " () { 'use strict'; }", SyntaxError);
367 assertThrows("function foo (" + word + ", " + word + ") { 'use strict'; }",
369 assertThrows("function foo (a, " + word + ") { 'use strict'; }", SyntaxError);
370 assertThrows("function foo (" + word + ", a) { 'use strict'; }", SyntaxError);
371 assertThrows("function foo (a, " + word + ", b) { 'use strict'; }",
373 assertThrows("var foo = function (" + word + ") { 'use strict'; }",
376 // setter parameter when the body is strict
378 assertThrows("var x = { set foo(" + word + ") { 'use strict'; } };",
390 assertTrue(should_throw, "strict mode");
391 assertInstanceof(e, ReferenceError, "strict mode");
394 assertFalse(should_throw, "strict mode");
402 "use strict";
431 "use strict";
472 "use strict";
476 "use strict";
505 function strict() {
506 "use strict";
513 // Non-strict call.
520 // Non-strict apply.
527 // Strict call.
528 assertTrue(strict.call(null) === null);
529 assertTrue(strict.call(undefined) === undefined);
530 assertEquals(typeof strict.call(7), "number");
531 assertEquals(typeof strict.call("Hello"), "string");
532 assertTrue(strict.call(object) === object);
534 // Strict apply.
535 assertTrue(strict.apply(null) === null);
536 assertTrue(strict.apply(undefined) === undefined);
537 assertEquals(typeof strict.apply(7), "number");
538 assertEquals(typeof strict.apply("Hello"), "string");
539 assertTrue(strict.apply(object) === object);
544 function strict() {
545 "use strict";
563 t.prototype.strict = strict;
565 t.prototype[strict_number] = strict;
568 { get: function() { return strict; },
574 { get: function() { return strict; },
582 delete t.prototype.strict;
598 return o.strict();
635 assertEquals(("hello").strict(), "string");
642 assertEquals((10 + i).strict(), "number");
649 assertEquals((true).strict(), "boolean");
656 assertEquals((false).strict(), "boolean");
765 "use strict";
778 "use strict";
789 function strict(o) {
790 "use strict";
794 assertThrows(function() { strict(frozen); }, TypeError);
795 assertThrows(function() { strict(sealed); }, TypeError);
800 "use strict";
835 function strict(o, name) {
836 "use strict";
843 strict(o, name);
858 "use strict";
876 "use strict";
894 "use strict";
912 "use strict";
970 "use strict";
992 "use strict";
1005 function strict(a, b) {
1006 "use strict";
1018 assertEquals(["c", "d", "a", "b"], strict("a", "b"));
1030 assertThrows(function() { 'use strict'; pill.property = "value"; },
1049 function strict() {
1050 "use strict";
1052 assertThrows(function() { strict.caller; }, TypeError);
1053 assertThrows(function() { strict.arguments; }, TypeError);
1054 assertThrows(function() { strict.caller = 42; }, TypeError);
1055 assertThrows(function() { strict.arguments = 42; }, TypeError);
1057 var another = new Function("'use strict'");
1063 var third = (function() { "use strict"; return function() {}; })();
1069 CheckPillDescriptor(strict, "caller");
1070 CheckPillDescriptor(strict, "arguments");
1079 "use strict";
1085 // Strict functions must have writable prototype.
1100 function strict() {
1101 "use strict";
1105 var args = strict();
1109 args = strict(17, "value", strict);
1112 assertEquals(strict, args[2]);
1117 "use strict";
1128 args = outer()(17, "value", strict);
1131 assertEquals(strict, args[2]);
1142 function strict() {
1143 "use strict";
1146 assertThrows(strict, TypeError);
1156 function strict(n) {
1157 "use strict";
1175 recurse(n, function() { strict(n); });
1189 "use strict";