Skip to content

Commit 14b6bec

Browse files
shvaikaleshleobalter
authored andcommitted
Add unary operators with NewTarget test (#2199)
1 parent f7f07a9 commit 14b6bec

File tree

1 file changed

+31
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)