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 // 'use strict' in non-directive position.
73 "use strict";
77 // Multiple directives, including "use strict".
81 "use strict";\
82 "directive after strict";\
86 // 'with' disallowed in strict mode.
132 // Strict mode applies to the function in which the directive is used..
135 "use strict";\
138 // Strict mode doesn't affect the outer stop of strict code.
140 function Strict() {
141 "use strict";
154 "use strict";
159 // Octal before "use strict"
161 function strict() {\
163 "use strict";\
179 "use strict";
188 // Two getters (non-strict)
193 // Two setters (non-strict)
198 // Setter and data (non-strict)
212 // Getter and data (non-strict)
221 CheckStrictMode("function strict() { eval = undefined; }", SyntaxError);
222 CheckStrictMode("function strict() { arguments = undefined; }", SyntaxError);
223 CheckStrictMode("function strict() { print(eval = undefined); }", SyntaxError);
224 CheckStrictMode("function strict() { print(arguments = undefined); }",
226 CheckStrictMode("function strict() { var x = eval = undefined; }", SyntaxError);
227 CheckStrictMode("function strict() { var x = arguments = undefined; }",
231 CheckStrictMode("function strict() { eval *= undefined; }", SyntaxError);
232 CheckStrictMode("function strict() { arguments /= undefined; }", SyntaxError);
233 CheckStrictMode("function strict() { print(eval %= undefined); }", SyntaxError);
234 CheckStrictMode("function strict() { print(arguments %= undefined); }",
236 CheckStrictMode("function strict() { var x = eval += undefined; }",
238 CheckStrictMode("function strict() { var x = arguments -= undefined; }",
240 CheckStrictMode("function strict() { eval <<= undefined; }", SyntaxError);
241 CheckStrictMode("function strict() { arguments >>= undefined; }", SyntaxError);
242 CheckStrictMode("function strict() { print(eval >>>= undefined); }",
244 CheckStrictMode("function strict() { print(arguments &= undefined); }",
246 CheckStrictMode("function strict() { var x = eval ^= undefined; }",
248 CheckStrictMode("function strict() { var x = arguments |= undefined; }",
252 CheckStrictMode("function strict() { eval++; }", SyntaxError);
253 CheckStrictMode("function strict() { arguments++; }", SyntaxError);
254 CheckStrictMode("function strict() { print(eval++); }", SyntaxError);
255 CheckStrictMode("function strict() { print(arguments++); }", SyntaxError);
256 CheckStrictMode("function strict() { var x = eval++; }", SyntaxError);
257 CheckStrictMode("function strict() { var x = arguments++; }", SyntaxError);
260 CheckStrictMode("function strict() { eval--; }", SyntaxError);
261 CheckStrictMode("function strict() { arguments--; }", SyntaxError);
262 CheckStrictMode("function strict() { print(eval--); }", SyntaxError);
263 CheckStrictMode("function strict() { print(arguments--); }", SyntaxError);
264 CheckStrictMode("function strict() { var x = eval--; }", SyntaxError);
265 CheckStrictMode("function strict() { var x = arguments--; }", SyntaxError);
268 CheckStrictMode("function strict() { ++eval; }", SyntaxError);
269 CheckStrictMode("function strict() { ++arguments; }", SyntaxError);
270 CheckStrictMode("function strict() { print(++eval); }", SyntaxError);
271 CheckStrictMode("function strict() { print(++arguments); }", SyntaxError);
272 CheckStrictMode("function strict() { var x = ++eval; }", SyntaxError);
273 CheckStrictMode("function strict() { var x = ++arguments; }", SyntaxError);
276 CheckStrictMode("function strict() { --eval; }", SyntaxError);
277 CheckStrictMode("function strict() { --arguments; }", SyntaxError);
278 CheckStrictMode("function strict() { print(--eval); }", SyntaxError);
279 CheckStrictMode("function strict() { print(--arguments); }", SyntaxError);
280 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError);
281 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError);
283 // Use of const in strict mode is disallowed in anticipation of ES Harmony.
286 CheckStrictMode("function strict() { const x = 0; }", SyntaxError);
288 // Strict mode only allows functions in SourceElements
298 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError);
301 CheckStrictMode("function strict(parameter) { delete parameter; }",
303 CheckStrictMode("function strict() { var variable; delete variable; }",
308 "use strict";
309 // "delete this" is allowed in strict mode and should work.
314 // Prefix unary operators other than delete, ++, -- are valid in strict mode
316 "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 + ") 'use strict'; {}", SyntaxError);
368 assertThrows("function foo (" + word + ", " + word + ") { 'use strict'; }",
370 assertThrows("function foo (a, " + word + ") { 'use strict'; }", SyntaxError);
371 assertThrows("function foo (" + word + ", a) { 'use strict'; }", SyntaxError);
372 assertThrows("function foo (a, " + word + ", b) { 'use strict'; }",
374 assertThrows("var foo = function (" + word + ") { 'use strict'; }",
377 // get/set when the body is strict
378 eval("var x = { get " + word + " () { 'use strict'; } };");
379 eval("var x = { set " + word + " (value) { 'use strict'; } };");
380 assertThrows("var x = { get foo(" + word + ") { 'use strict'; } };",
382 assertThrows("var x = { set foo(" + word + ") { 'use strict'; } };",
394 assertTrue(should_throw, "strict mode");
395 assertInstanceof(e, ReferenceError, "strict mode");
398 assertFalse(should_throw, "strict mode");
406 "use strict";
435 "use strict";
476 "use strict";
480 "use strict";
509 function strict() {
510 "use strict";
517 // Non-strict call.
524 // Non-strict apply.
531 // Strict call.
532 assertTrue(strict.call(null) === null);
533 assertTrue(strict.call(undefined) === undefined);
534 assertEquals(typeof strict.call(7), "number");
535 assertEquals(typeof strict.call("Hello"), "string");
536 assertTrue(strict.call(object) === object);
538 // Strict apply.
539 assertTrue(strict.apply(null) === null);
540 assertTrue(strict.apply(undefined) === undefined);
541 assertEquals(typeof strict.apply(7), "number");
542 assertEquals(typeof strict.apply("Hello"), "string");
543 assertTrue(strict.apply(object) === object);
548 function strict() {
549 "use strict";
567 t.prototype.strict = strict;
569 t.prototype[strict_number] = strict;
572 { get: function() { return strict; },
578 { get: function() { return strict; },
586 delete t.prototype.strict;
602 return o.strict();
639 assertEquals(("hello").strict(), "string");
646 assertEquals((10 + i).strict(), "number");
653 assertEquals((true).strict(), "boolean");
660 assertEquals((false).strict(), "boolean");
769 "use strict";
782 "use strict";
793 function strict(o) {
794 "use strict";
798 assertThrows(function() { strict(frozen); }, TypeError);
799 assertThrows(function() { strict(sealed); }, TypeError);
804 "use strict";
839 function strict(o, name) {
840 "use strict";
846 strict(o, name);
860 "use strict";
878 "use strict";
896 "use strict";
914 "use strict";
972 "use strict";
994 "use strict";
1007 function strict(a, b) {
1008 "use strict";
1020 assertEquals(["c", "d", "a", "b"], strict("a", "b"));
1032 assertThrows(function() { 'use strict'; pill.property = "value"; },
1051 function strict() {
1052 "use strict";
1054 assertThrows(function() { strict.caller; }, TypeError);
1055 assertThrows(function() { strict.arguments; }, TypeError);
1057 var another = new Function("'use strict'");
1061 var third = (function() { "use strict"; return function() {}; })();
1065 CheckPillDescriptor(strict, "caller");
1066 CheckPillDescriptor(strict, "arguments");
1075 "use strict";
1081 // Strict functions must have writable prototype.
1096 function strict() {
1097 "use strict";
1101 var args = strict();
1105 args = strict(17, "value", strict);
1108 assertEquals(strict, args[2]);
1113 "use strict";
1124 args = outer()(17, "value", strict);
1127 assertEquals(strict, args[2]);
1138 function strict() {
1139 "use strict";
1142 assertThrows(strict, TypeError);
1152 function strict(n) {
1153 "use strict";
1171 recurse(n, function() { strict(n); });