1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
4 * Any copyright is dedicated to the Public Domain.
5 * http://creativecommons.org/licenses/publicdomain/
8 /* Deleting an identifier is a syntax error in strict mode code only. */
9 assertEq(testLenientAndStrict('delete x;',
11 parseRaisesException(SyntaxError
)),
15 * A reference expression surrounded by parens is itself a reference
18 assertEq(testLenientAndStrict('delete (x);',
20 parseRaisesException(SyntaxError
)),
23 /* Deleting other sorts of expressions are not syntax errors in either mode. */
24 assertEq(testLenientAndStrict('delete x.y;',
29 /* Functions should inherit the surrounding code's strictness. */
30 assertEq(testLenientAndStrict('function f() { delete x; }',
32 parseRaisesException(SyntaxError
)),
35 /* Local directives override the surrounding code's strictness. */
36 assertEq(testLenientAndStrict('function f() { "use strict"; delete x; }',
37 parseRaisesException(SyntaxError
),
38 parseRaisesException(SyntaxError
)),
41 reportCompare(true, true);
43 var successfullyParsed
= true;