Debian Codegraph @

js/src/tests/test262/language/expressions/new.target/unary-expr.js

raw
1 // |reftest| async
2 // Copyright (C) 2019 Alexey Shvayka. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: prod-UnaryExpression
6 description: >
7 While increments and decrements are restricted to use with NewTarget,
8 other unary operators should not throw SyntaxError.
9 info: |
10 UnaryExpression[Yield, Await]:
11 UpdateExpression[?Yield, ?Await]:
12 LeftHandSideExpression[?Yield, ?Await]:
13 NewExpression[?Yield, ?Await]:
14 MemberExpression[Yield, Await]:
15 MetaProperty:
16 NewTarget
17 features: [new.target, async-functions]
18 flags: [async]
19 includes: [asyncHelpers.js]
20 ---*/
21
22 (function() { assert.sameValue(delete (new.target), true); })();
23 (function() { assert.sameValue(void new.target, undefined); })();
24 new function() { assert.sameValue(typeof new.target, 'function'); };
25 new function() { assert.sameValue(+(new.target), NaN); };
26 (function() { assert.sameValue(-(new.target), NaN); })();
27 new function() { assert.sameValue(~new.target, -1); };
28 (function() { assert.sameValue(!new.target, true); })();
29 new function() { assert.sameValue(delete void typeof +-~!(new.target), true); };
30
31 asyncTest(async function() {
32 assert.sameValue(await new.target, undefined);
33 });