|
| 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